Advertisement
SRD

link

SRD
Jun 17th, 2016
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 3.14 KB | None | 0 0
  1. /*
  2. I'm using the com.android.tools.build:gradle-experimental:0.7.0 plugin and trying to get a library to build.
  3.  
  4. $ ./gradlew assemble
  5. Incremental java compilation is an incubating feature.
  6. :app:copyArmeabi-v7aDebugSharedLibraryStlSo
  7. :libraries:testA:copyArmeabi-v7aDebugSharedLibraryStlSo
  8. :libraries:testA:compiletestAArmeabi-v7aDebugSharedLibrarytestAMainC
  9. :libraries:testA:linktestAArmeabi-v7aDebugSharedLibrary
  10. /home/pepp/tools/android/sdk/ndk-bundle/sources/android/native_app_glue/android_native_app_glue.c:233: error: undefined reference to 'android_main'
  11. collect2: error: ld returned 1 exit status
  12.  
  13. :libraries:testA:linktestAArmeabi-v7aDebugSharedLibrary FAILED
  14.  
  15. FAILURE: Build failed with an exception.
  16.  
  17. * What went wrong:
  18. Execution failed for task ':libraries:testA:linktestAArmeabi-v7aDebugSharedLibrary'.
  19. > A build operation failed.
  20.       Linker failed while linking libtestA.so.
  21.   See the complete log at: file:///home/pepp/workspace/ri/rn/libraries/testA/build/tmp/linktestAArmeabi-v7aDebugSharedLibrary/output.txt
  22.  
  23. * Try:
  24. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  25.  
  26. BUILD FAILED
  27.  
  28. Total time: 4.301 secs
  29.  
  30. */
  31.  
  32. // this is build.gradle for the testA library
  33. apply plugin: 'com.android.model.library'
  34.  
  35. def ndkDir = System.getenv("ANDROID_NDK_HOME")
  36. def propertiesFile = project.rootProject.file('local.properties')
  37.  
  38. if (propertiesFile.exists()) {
  39.     Properties properties = new Properties()
  40.     properties.load(propertiesFile.newDataInputStream())
  41.     ndkDir = properties.getProperty('ndk.dir')
  42. }
  43.  
  44. model {
  45.     android {
  46.         compileSdkVersion 24
  47.         buildToolsVersion "24.0.0"
  48.  
  49.         defaultConfig {
  50.             minSdkVersion.apiLevel 21
  51.             targetSdkVersion.apiLevel 24
  52.             versionCode 1
  53.             versionName "1.0"
  54.            
  55.             buildConfigFields {
  56.                 create() {
  57.                     type "int"
  58.                     name "VALUE"
  59.                     value "1"
  60.                 }
  61.             }
  62.         }
  63.        
  64.         ndk {
  65.             platformVersion = 21
  66.             moduleName = 'testA'
  67.             stl = 'gnustl_shared'
  68.             cppFlags.add('--std=c++11')
  69.             ldLibs.addAll(['log', 'android', 'stdc++', 'dl'])
  70.             CFlags.addAll(['-Wall'])
  71.         }
  72.        
  73.         buildTypes {
  74.             release {
  75.                 minifyEnabled false
  76.                 proguardFiles.add(file("proguard-rules.pro"))
  77.             }
  78.         }
  79.        
  80.         productFlavors {
  81.             create("arm") {
  82.                 ndk {
  83.                     abiFilters.add("armeabi-v7a")
  84.                 }
  85.             }
  86.         }
  87.        
  88.         sources {
  89.             main {
  90.                 jni {
  91.                     source {
  92.                         srcDir "cpp"
  93.                         srcDir "${ndkDir}/sources/android/native_app_glue"
  94.                     }
  95.                     exportedHeaders {
  96.                         srcDir "includes"
  97.                         srcDir "${ndkDir}/sources/android/native_app_glue"
  98.                     }
  99.                 }
  100.             }
  101.         }
  102.     }
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement