2016-04-28 22 views
1

私はAndroid Studio 2.0でオープンソースプロジェクトを実行しようとしています。私の問題は、クラスIoBridge(import libcore.io.IoBridge;)をインポートできないことです。コンパイラはlibcoreが存在しないと言っています。そして実際に私のSDK(リビジョン23)にlibcoreという名前のライブラリはありません。以下はコードです。ライブラリlibcore.io.IoBridgeをインポートできません

/* 
* Licensed to the Apache Software Foundation (ASF) under one or more 
* contributor license agreements. See the NOTICE file distributed with 
* this work for additional information regarding copyright ownership. 
* The ASF licenses this file to You under the Apache License, Version 2.0 
* (the "License"); you may not use this file except in compliance with 
* the License. You may obtain a copy of the License at 
* 
*  http://www.apache.org/licenses/LICENSE-2.0 
* 
* Unless required by applicable law or agreed to in writing, software 
* distributed under the License is distributed on an "AS IS" BASIS, 
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
* See the License for the specific language governing permissions and 
* limitations under the License. 
*/ 

package java.net; 

import java.io.Closeable; 
import java.io.FileDescriptor; 
import java.io.IOException; 
import java.io.InputStream; 
import java.io.OutputStream; 
import java.nio.channels.SocketChannel; 
import libcore.io.IoBridge; 

enter image description here

答えて

1

どうやら、そのコードは、システム・ファームウェアの一部としてではなく、AndroidのSDKアプリから構築するように設計されています。 libcoreは、Android SDKアプリの開発者は利用できません。

具体的には、スクリーンショットに基づいて、java.net.SocketをAndroidオープンソースプロジェクトからコンパイルしようとしているように見えますが、これはAndroidアプリの一部としてコンパイルされていません。

+0

ありがとうございます。今私はどうすればいいですか? libcoreをインポートするための外部ライブラリを作成する必要がありますか?はいの場合どのように? – pape

+0

@pape:おそらく、このコードを最初に使用しないでください。あなたは、 'java.net.Socket'の修正版を含む独自のカスタムROMを構築し、そのカスタムROMをあなたのデバイスにインストールすることを歓迎します。あるいは、 'Socket'を再実装するのではなく、' Socket'をサブクラス化することを検討してください。 – CommonsWare

+0

そして、ライブラリのlibcoreをSDKソースに追加しようとすると、どうしてうまくいかないのですか? ( – pape

関連する問題