我正在尝试在Android Studio 2.0中运行一个开源项目。我的问题是我无法导入类IoBridge(import libcore.io.IoBridge;
)。编译器说libcore不存在。实际上,在我的SDK(修订版23)中,没有名为libcore的库。下面是代码。
/*
* 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
最佳答案
显然,该代码旨在构建为系统固件的一部分,而不是通过Android SDK应用程序构建。 libcore
不适用于Android SDK应用程序开发人员。
具体来说,根据屏幕截图,您似乎正在尝试从Android开源项目中编译java.net.Socket
,该项目并非旨在作为Android应用程序的一部分进行编译。