0
Android NDK, JAVA
Chào mọi người. Mình mới bắt đầu tìm hiểu về android NDk và có lấy source của 1 project trên mạng về Build thử nhưng có lỗi khi build. Mong mọi người chỉ giúp mình với. cảm ơn các bạn nhiều.
Lỗi của mình ra như sau: Build command failed.
Error while executing process C:\Users\A\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\A\Desktop\breadwallet\breadwallet-android-master\app -BC:\Users\A\Desktop\breadwallet\breadwallet-android-master\app\.externalNativeBuild\cmake\brdTestnetRelease\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-18 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\A\Desktop\breadwallet\breadwallet-android-master\app\build\intermediates\cmake\brdTestnet\release\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DANDROID_NDK=C:\Users\A\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_C_FLAGS=-DBITCOIN_TESTNET=1 -DCMAKE_TOOLCHAIN_FILE=C:\Users\A\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=C:\Users\A\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja -DANDROID_TOOLCHAIN=clang}
-- Check for working C compiler: C:/Users/A/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
-- Check for working C compiler: C:/Users/A/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- works
File build.gradle của mình như sau :
apply plugin: 'com.android.application'
android {
compileSdkVersion = 27
buildToolsVersion = '27.0.3'
defaultConfig {
testInstrumentationRunner = 'android.support.test.runner.AndroidJUnitRunner'
applicationId = 'com.breadwallet'
minSdkVersion 18
targetSdkVersion 27
versionCode 231
versionName "231"
multiDexEnabled true
// Similar to other properties in the defaultConfig block,
// you can configure the ndk block for each product flavor
// in your build configuration.
ndk {
// Specifies the ABI configurations of your native
// libraries Gradle should build and package with your APK.
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
}
externalNativeBuild {
cmake {
arguments '-DANDROID_TOOLCHAIN=clang'
}
}
// externalNativeBuild {
// cmake {
// arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=gnustl_static'
// }
// }
}
testOptions {
unitTests.returnDefaultValues = true
}
packagingOptions {
pickFirst 'protobuf.meta'
}
externalNativeBuild {
cmake {
// When you specify a version of CMake, as shown below,
// the Android plugin searches for its binary within your
// PATH environmental variable.
path "CMakeLists.txt" //path can only be set outside (in android block)
}
}
// Specifies two flavor dimensions.
flavorDimensions "mode"
productFlavors {
brd {
applicationId = "com.breadwallet"
dimension "mode"
resValue "string", "app_name", "BRD"
buildConfigField "boolean", "BITCOIN_TESTNET", "false"
externalNativeBuild {
cmake {
// When you specify a version of CMake, as shown below,
// the Android plugin searches for its binary within your
// PATH environmental variable.
cFlags "-DBITCOIN_TESTNET=0"
targets "core"
}
}
}
brdTestnet {
applicationId = "com.breadtestnet"
dimension "mode"
resValue "string", "app_name", "BRD-testnet"
buildConfigField "boolean", "BITCOIN_TESTNET", "true"
externalNativeBuild {
cmake {
// When you specify a version of CMake, as shown below,
// the Android plugin searches for its binary within your
// PATH environmental variable.
cFlags "-DBITCOIN_TESTNET=1"
targets "core"
}
}
}
}
lintOptions {
// set to true to turn off analysis progress reporting by lint
quiet false
explainIssues true
// if true, stop the gradle build if errors are found
abortOnError true
// if true, only report errors
ignoreWarnings false
checkReleaseBuilds false
disable 'MissingTranslation'
}
buildTypes {
// gitUpdateModules()
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
release {
minifyEnabled = false
debuggable = false
ndk {
minifyEnabled = false
debuggable = false
}
}
debug {
debuggable = true
jniDebuggable = true
minifyEnabled = false
ndk {
minifyEnabled = false
debuggable = true
jniDebuggable = true
}
}
}
sourceSets { main { java.srcDirs = ['src/main/java', 'src/main/jni/breadwallet-core/Java/root', 'src/main/jni/breadwallet-core/ethereum/Java/root'] } }
}
repositories {
mavenCentral()
google()
}
dependencies {
implementation 'commons-io:commons-io:2.4'
implementation 'org.eclipse.jetty:jetty-webapp:9.2.19.v20160908' //do not update
implementation 'org.eclipse.jetty.websocket:websocket-server:9.2.19.v20160908' //do not update
implementation 'org.eclipse.jetty:jetty-continuation:9.2.19.v20160908' //do not update
implementation 'org.slf4j:slf4j-api:1.7.22'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:gridlayout-v7:27.1.1'
implementation 'com.android.support:support-v13:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.squareup.okhttp3:okhttp:3.7.0'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.google.firebase:firebase-crash:12.0.1'
implementation 'io.sigpipe:jbsdiff:1.0'
implementation 'com.google.zxing:core:3.3.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support.test:runner:1.0.1'
implementation 'com.android.support.test:rules:1.0.1'
implementation 'junit:junit:4.12'
implementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'tools.fastlane:screengrab:1.1.0'
}
Thêm một bình luận