1. 程式人生 > >eclipse 專案轉as專案時 .so檔案 jniLibs的設定

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轉過來的,所以需要手動指定目錄。

不過不想在變動了 

看到這篇文章

其中
// 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:又學到一點東西,以後有時間還是應該多看看官方文件