【已解决】Android 6.0找不到类、.so、.jar文件

来源:互联网 发布:帝国分类目录源码 编辑:程序博客网 时间:2024/06/06 19:18

我也刚开始用Android Studio,想在的API 是 23,可是刚刚导入我的eclipse项目,就有很多问题:找不到各种文件,我也是醉了,不过已经解决了。

解决如下:打开build.gradle

dependencies {    compile fileTree(dir: 'libs', include: '*.jar')}

android {    compileSdkVersion 23    buildToolsVersion "23.0.0"    useLibrary 'org.apache.http.legacy'    //设置so引入     task nativeLibsToJar(type: Zip, description: "create a jar archive of the native libs") {        destinationDir file("$projectDir/libs")        baseName "Native_Libs2"        extension "jar"        from fileTree(dir: "libs", include: "**/*.so")        into "lib"    }    tasks.withType(JavaCompile) {        compileTask -> compileTask.dependsOn(nativeLibsToJar)    }    //.so引入 end    sourceSets {        main {            manifest.srcFile 'AndroidManifest.xml'            java.srcDirs = ['src']            resources.srcDirs = ['src']            aidl.srcDirs = ['src']            renderscript.srcDirs = ['src']            res.srcDirs = ['res']            assets.srcDirs = ['assets']        }        // Move the tests to tests/java, tests/res, etc...        instrumentTest.setRoot('tests')        // Move the build types to build-types/<type>        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...        // This moves them out of them default location under src/<type>/... which would        // conflict with src/ being used by the main source set.        // Adding new build types or product flavors should be accompanied        // by a similar customization.        debug.setRoot('build-types/debug')        release.setRoot('build-types/release')    }}
我是这样解决的,复制粘贴,如果不可以,那我也没办法了。具体细节还是不很了解。

1 0
原创粉丝点击