eclipse 项目转as项目时 .so文件 jniLibs的设置


接着上篇:http://blog.csdn.net/u011644423/article/details/46989167 转换项目 还是出现了问题

 java.lang.UnsatisfiedLinkError: Couldn't load BaiduMapSDK_v3_0_0 from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.volcano.axehelp-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.volcano.axehelp-1, /vendor/lib, /system/li

很明显 是so文件的问题, 记得之前处理过so的存放,之前是

用这个方法的 建立jniLibs文件夹

Android studio默认不会包括libs里面的so文件,如果是so文件,默认是放在main/jniLibs目录里面。因为我的项目是从eclipse转过来的,所以需要手动指定目录。

不过不想在变动了 

看到这篇文章

Android eclipse项目转成Android studio项目遇到的问题

其中

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0-rc1'
    }
}
apply plugin: 'android'

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile 'com.android.support:appcompat-v7:21.0.+'
    compile project(':libraries:appirater-android')
}

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
            jniLibs.srcDirs = ['libs']
        }

        // 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')
    }
}
可以看出
 sourceSets {
        main {
这个可以设置很多东西

PS:又学到一点东西,以后有时间还是应该多看看官方文档

版权声明:本文为博主原创文章,未经博主允许不得转载。

原文地址:https://www.cnblogs.com/france/p/4808547.html