无法导入库libcore.io.IoBridge

时间:2016-04-28 13:09:34

标签: java android sockets jar static-libraries

我正在尝试在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

1 个答案:

答案 0 :(得分:1)

显然,该代码旨在构建为系统固件的一部分,而不是Android SDK应用程序。 Android SDK应用开发者无法使用libcore

具体来说,根据屏幕截图,您似乎正在尝试从Android开放源代码项目编译java.net.Socket,该项目并非旨在作为Android应用程序的一部分进行编译。