Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- I'm using the com.android.tools.build:gradle-experimental:0.7.0 plugin and trying to get a library to build.
- $ ./gradlew assemble
- Incremental java compilation is an incubating feature.
- :app:copyArmeabi-v7aDebugSharedLibraryStlSo
- :libraries:testA:copyArmeabi-v7aDebugSharedLibraryStlSo
- :libraries:testA:compiletestAArmeabi-v7aDebugSharedLibrarytestAMainC
- :libraries:testA:linktestAArmeabi-v7aDebugSharedLibrary
- /home/pepp/tools/android/sdk/ndk-bundle/sources/android/native_app_glue/android_native_app_glue.c:233: error: undefined reference to 'android_main'
- collect2: error: ld returned 1 exit status
- :libraries:testA:linktestAArmeabi-v7aDebugSharedLibrary FAILED
- FAILURE: Build failed with an exception.
- * What went wrong:
- Execution failed for task ':libraries:testA:linktestAArmeabi-v7aDebugSharedLibrary'.
- > A build operation failed.
- Linker failed while linking libtestA.so.
- See the complete log at: file:///home/pepp/workspace/ri/rn/libraries/testA/build/tmp/linktestAArmeabi-v7aDebugSharedLibrary/output.txt
- * Try:
- Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
- BUILD FAILED
- Total time: 4.301 secs
- */
- // this is build.gradle for the testA library
- apply plugin: 'com.android.model.library'
- def ndkDir = System.getenv("ANDROID_NDK_HOME")
- def propertiesFile = project.rootProject.file('local.properties')
- if (propertiesFile.exists()) {
- Properties properties = new Properties()
- properties.load(propertiesFile.newDataInputStream())
- ndkDir = properties.getProperty('ndk.dir')
- }
- model {
- android {
- compileSdkVersion 24
- buildToolsVersion "24.0.0"
- defaultConfig {
- minSdkVersion.apiLevel 21
- targetSdkVersion.apiLevel 24
- versionCode 1
- versionName "1.0"
- buildConfigFields {
- create() {
- type "int"
- name "VALUE"
- value "1"
- }
- }
- }
- ndk {
- platformVersion = 21
- moduleName = 'testA'
- stl = 'gnustl_shared'
- cppFlags.add('--std=c++11')
- ldLibs.addAll(['log', 'android', 'stdc++', 'dl'])
- CFlags.addAll(['-Wall'])
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles.add(file("proguard-rules.pro"))
- }
- }
- productFlavors {
- create("arm") {
- ndk {
- abiFilters.add("armeabi-v7a")
- }
- }
- }
- sources {
- main {
- jni {
- source {
- srcDir "cpp"
- srcDir "${ndkDir}/sources/android/native_app_glue"
- }
- exportedHeaders {
- srcDir "includes"
- srcDir "${ndkDir}/sources/android/native_app_glue"
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement