我正在使用android studio并打开hello-jni示例项目。 但是,当我尝试编译项目时,它会提示:
Error:Cause: failed to find target with hash string 'android-23' in:
/Users/xx/opensource/android-sdk-macosx
<a href="openAndroidSdkManager">Open Android SDK Manager</a>
我安装了android 6.0(api 23)。为什么仍然提示找不到? 我在android stuido的偏好中查找,在android SDK选项卡中,似乎可以找到android 6.0(api level 23 revision 1)。
Belows是我的gradle文件:
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.0"
defaultConfig.with {
applicationId = "com.example.hellojni"
minSdkVersion.apiLevel = 3
targetSdkVersion.apiLevel = 23
}
}
/*
* native build settings
*/
android.ndk {
moduleName = "hello-jni"
/*
* Other ndk flags configurable here are
* cppFlags += "-fno-rtti"
* cppFlags += "-fno-exceptions"
* ldLibs = ["android", "log"]
* stl = "system"
*/
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.txt')
}
}
android.productFlavors {
// for detailed abiFilter descriptions, refer to "Supported ABIs" @
// https://developer.android.com/ndk/guides/abis.html#sa
create("arm") {
ndk.abiFilters += "armeabi"
}
create("arm7") {
ndk.abiFilters += "armeabi-v7a"
}
create("arm8") {
ndk.abiFilters += "arm64-v8a"
}
create("x86") {
ndk.abiFilters += "x86"
}
create("x86-64") {
ndk.abiFilters += "x86_64"
}
create("mips") {
ndk.abiFilters += "mips"
}
create("mips-64") {
ndk.abiFilters += "mips64"
}
// To include all cpu architectures, leaves abiFilters empty
create("all")
}
}
答案 0 :(得分:1)
我刚刚遇到同样的问题,我认为这是一个错误。但我设法使用以下解决方法:
答案 1 :(得分:1)
这对我有用:
我在AndroidStudioProjects下的主目录中删除了我正在处理的应用程序
重新启动Android Studio