【发布时间】:2017-12-07 15:17:09
【问题描述】:
我收到了一个 2014 年编码的旧代码,我被要求更新一些功能。
我在运行代码时遇到问题,因为它是在 Eclipse 上构建的,现在我将它导入 Android Studio。
首先,代码调用了项目中包含的3个库,其中一个在cpp中。这就是为什么我认为需要添加 bundle-ndk。
我在 gradle-wrapper.properties 中添加了:android.useDeprecatedNdk=true
这些是我目前拥有的 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:2.2.0'
}
}
allprojects {
repositories {
jcenter()
}
}
第一个库 Gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 16
buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 5
targetSdkVersion 16
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
第二个库
apply plugin: 'com.android.library'
android {
compileSdkVersion 16
buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 5
targetSdkVersion 5
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':FirstLibrary')
compile 'com.android.support:support-v4:18.0.0'
compile files('libs/libGoogleAnalyticsV2.jar')
}
第三图书馆
apply plugin: 'com.android.library'
android {
compileSdkVersion 16
buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 5
targetSdkVersion 7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
}
项目的模块Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 8
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.application.id"
minSdkVersion 8
targetSdkVersion 17
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
dependencies {
compile project(':secondLbrary')
compile project(':thirdLibrary')
}
收到的最新错误:
错误:任务“:library:compileDebugNdk”执行失败。
错误:您的项目包含 C++ 文件,但未使用受支持的本机构建系统。 考虑将 CMake 或 ndk-build 与稳定的 Android Gradle 插件集成: https://developer.android.com/studio/projects/add-native-code.html 或使用实验插件: http://tools.android.com/tech-docs/new-build-system/gradle-experimental.
我能做些什么来调查这个?
【问题讨论】:
标签: c++ android-studio gradle android-ndk