1、编译成so文件时报错问题:
Error:Execution failed for task ':app:compileDebugNdk'.
> Error: Your project contains C++ files but it is not using a supported native build system.
Consider using CMake or ndk-build integration with the stable Android Gradle plugin:
https://developer.android.com/studio/projects/add-native-code.html
or use the experimental plugin:
https://developer.android.com/studio/build/experimental-plugin.html.
解决办法:
在项目的gradle.properties添加android.useDeprecatedNdk=true
在module的build.gradle(Module:app)的buildTypes上面添加sourceSets属性
sourceSets {
main {
jni.srcDirs = ['src/main/jni', 'src/main/jni/']
jniLibs.srcDirs 'src/main/libs'
}
}
最后运行gradle脚本更新build,在编译module即可。
这个问题主要是因为Android studio以前使用ndkCompile后来废弃掉了,Android-Terminal-Emulator没有最近没有更新的缘故。具体的编译最新的NDK编译方式可以看官网
https://developer.android.com/studio/projects/add-native-code.html
2、Error:Execution failed for task ':app:compileDebugNdk'.
> com.android.ide.common.process.ProcessException: Error while executing process D:\installTools\sdk\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=D:\tool\ReadUSB1\ReadUSB\app\build\intermediates\ndk\debug\Android.mk APP_PLATFORM=android-25 NDK_OUT=D:\tool\ReadUSB1\ReadUSB\app\build\intermediates\ndk\debug\obj NDK_LIBS_OUT=D:\tool\ReadUSB1\ReadUSB\app\build\intermediates\ndk\debug\lib APP_STL=stlport_shared APP_ABI=armeabi-v7a,armeabi,x86}
解决办法:修改build.gradle文件
android {
compileSdkVersion 26
buildToolsVersion '26.0.1'
defaultConfig {
applicationId "com.android.read"
minSdkVersion 25
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android
Error:Execution failed for task ':app:compileDebugNdk'.
> Error: Your project contains C++ files but it is not using a supported native build system.
Consider using CMake or ndk-build integration with the stable Android Gradle plugin:
https://developer.android.com/studio/projects/add-native-code.html
or use the experimental plugin:
https://developer.android.com/studio/build/experimental-plugin.html.
解决办法:
在项目的gradle.properties添加android.useDeprecatedNdk=true
在module的build.gradle(Module:app)的buildTypes上面添加sourceSets属性
sourceSets {
main {
jni.srcDirs = ['src/main/jni', 'src/main/jni/']
jniLibs.srcDirs 'src/main/libs'
}
}
最后运行gradle脚本更新build,在编译module即可。
这个问题主要是因为Android studio以前使用ndkCompile后来废弃掉了,Android-Terminal-Emulator没有最近没有更新的缘故。具体的编译最新的NDK编译方式可以看官网
https://developer.android.com/studio/projects/add-native-code.html
2、Error:Execution failed for task ':app:compileDebugNdk'.
> com.android.ide.common.process.ProcessException: Error while executing process D:\installTools\sdk\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=D:\tool\ReadUSB1\ReadUSB\app\build\intermediates\ndk\debug\Android.mk APP_PLATFORM=android-25 NDK_OUT=D:\tool\ReadUSB1\ReadUSB\app\build\intermediates\ndk\debug\obj NDK_LIBS_OUT=D:\tool\ReadUSB1\ReadUSB\app\build\intermediates\ndk\debug\lib APP_STL=stlport_shared APP_ABI=armeabi-v7a,armeabi,x86}
解决办法:修改build.gradle文件
android {
compileSdkVersion 26
buildToolsVersion '26.0.1'
defaultConfig {
applicationId "com.android.read"
minSdkVersion 25
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android