【发布时间】:2015-05-02 18:02:17
【问题描述】:
我知道这个问题被问了很多次,但在发布我的查询之前我已经做了深入的研究。
我已将 Android Studio 更新到 2015 年 3 月 2 日的最新版本,即 1.1.0 版。我认为仍然 Grade 不会自行打包 .so 文件。
我在 /jni 文件夹中编写了 NewNDK.c。运行 ndk-build 脚本并在 /libs 中创建 .so 文件。根据其中一篇文章的建议,我将 libs 修改为 lib。
即便如此,我仍然收到 java.lang.UnsatisfiedLinkError: Couldn't load from loader dalvik.system.PathClassLoader findLibrary returned null 错误。
帖子没有说明要修改哪些文件。我是 Android 新手,请求您的帮助。
我已将问题缩小到:1. Gradle 未打包 2. Gradle 脚本应修改。
build.gradle(模块:app)如下:
应用插件:'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.raghu.newndk"
minSdkVersion 17
targetSdkVersion 17
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
build.gradle(项目)如下:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
请让我知道缺少什么。
谢谢!
【问题讨论】:
标签: android-ndk