如何配置NDK项目Android Studio中1.3 [英] How to configure NDK project in Android Studio 1.3
问题描述
我一直在努力按照这配置的Android工作室的NDK文章和这个文章。以下是我gradle-wrapper.properties的内容
I have been trying to configure Android Studio for NDk by following this article and this article. The following are the contents of my gradle-wrapper.properties
#Sat Aug 08 09:36:53 IST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip
以下是的build.gradle的内容(项目)
Following is the contents of build.gradle(project)
// 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-experimental:0.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
和最后的build.gradle(模块)
and finally the build.gradle(module)
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 22
buildToolsVersion = "23.0.0 rc3"
defaultConfig.with {
applicationId = "com.opaxlabs.nativetest"
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 22
versionCode = 1
versionName = "1.0"
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.pro')
}
}
}
android.ndk{
moduleName = "native"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
}
当我尝试同步文件的gradle我收到以下错误:
when I try to sync gradle files I get the following error:
Error:No such property: android for class: com.android.build.gradle.managed.AndroidConfig
以下路径在local.properties定义
the following paths are defined in local.properties
ndk.dir=/opt/adt-bundle-linux-x86_64-20140702/sdk/ndk-bundle
sdk.dir=/opt/adt-bundle-linux-x86_64-20140702/sdk
所以它看起来像我错过了一些东西只有我能不能找到它。
任何帮助将大大AP preciated。
so it looks like I have missed something only I can't locate it. Any help will be greatly appreciated.
推荐答案
在您的build.gradle(模块),在 android.buildTypes 块需要在的Android之外块。因此,它应该是这样的:
In your build.gradle(module), the android.buildTypes block needs to outside of the android block. So it should look like this:
model {
android {
compileSdkVersion = 22
buildToolsVersion = "23.0.0 rc3"
defaultConfig.with {
applicationId = "com.opaxlabs.nativetest"
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 22
versionCode = 1
versionName = "1.0"
}
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.pro')
}
}
android.ndk{
moduleName = "native"
}
}
这篇关于如何配置NDK项目Android Studio中1.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!