Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.19 KB | None | 0 0
  1. android {
  2. buildToolsVersion "25.0.2"
  3. compileSdkVersion 25
  4. sourceSets {
  5. main {
  6. manifest.srcFile 'AndroidManifest.xml'
  7. java.srcDirs = ['src']
  8. aidl.srcDirs = ['src']
  9. renderscript.srcDirs = ['src']
  10. res.srcDirs = ['res']
  11. assets.srcDirs = ['assets']
  12. jniLibs.srcDirs = ['libs']
  13. }
  14.  
  15. instrumentTest.setRoot('tests')
  16. }
  17. packagingOptions {
  18. exclude 'META-INF/robovm/ios/robovm.xml'
  19. }
  20. defaultConfig {
  21. applicationId "com.gdx.android"
  22. minSdkVersion 8
  23. targetSdkVersion 25
  24. }
  25. }
  26.  
  27.  
  28. // called every time gradle gets executed, takes the native dependencies of
  29. // the natives configuration, and extracts them to the proper libs/ folders
  30. // so they get packed with the APK.
  31. task copyAndroidNatives() {
  32. file("libs/armeabi/").mkdirs();
  33. file("libs/armeabi-v7a/").mkdirs();
  34. file("libs/arm64-v8a/").mkdirs();
  35. file("libs/x86_64/").mkdirs();
  36. file("libs/x86/").mkdirs();
  37.  
  38. configurations.natives.files.each { jar ->
  39. def outputDir = null
  40. if(jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
  41. if(jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
  42. if(jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi")
  43. if(jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64")
  44. if(jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
  45. if(outputDir != null) {
  46. copy {
  47. from zipTree(jar)
  48. into outputDir
  49. include "*.so"
  50. }
  51. }
  52. }
  53. }
  54.  
  55. task run(type: Exec) {
  56. def path
  57. def localProperties = project.file("../local.properties")
  58. if (localProperties.exists()) {
  59. Properties properties = new Properties()
  60. localProperties.withInputStream { instr ->
  61. properties.load(instr)
  62. }
  63. def sdkDir = properties.getProperty('sdk.dir')
  64. if (sdkDir) {
  65. path = sdkDir
  66. } else {
  67. path = "$System.env.ANDROID_HOME"
  68. }
  69. } else {
  70. path = "$System.env.ANDROID_HOME"
  71. }
  72.  
  73. def adb = path + "/platform-tools/adb"
  74. commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.gdx.android/com.gdx.android.AndroidLauncher', 'com.android.tools.build:gradle:2.2.3'
  75. }
  76.  
  77. // sets up the Android Eclipse project, using the old Ant based build.
  78. eclipse {
  79. // need to specify Java source sets explicitly, SpringSource Gradle Eclipse plugin
  80. // ignores any nodes added in classpath.file.withXml
  81. sourceSets {
  82. main {
  83. java.srcDirs "src", 'gen'
  84. }
  85. }
  86.  
  87. jdt {
  88. sourceCompatibility = 1.6
  89. targetCompatibility = 1.6
  90. }
  91.  
  92. classpath {
  93. plusConfigurations += [ project.configurations.compile ]
  94. containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES'
  95. }
  96.  
  97. project {
  98. name = appName + "-android"
  99. natures 'com.android.ide.eclipse.adt.AndroidNature'
  100. buildCommands.clear();
  101. buildCommand "com.android.ide.eclipse.adt.ResourceManagerBuilder"
  102. buildCommand "com.android.ide.eclipse.adt.PreCompilerBuilder"
  103. buildCommand "org.eclipse.jdt.core.javabuilder"
  104. buildCommand "com.android.ide.eclipse.adt.ApkBuilder"
  105. }
  106. }
  107.  
  108. // sets up the Android Idea project, using the old Ant based build.
  109. idea {
  110. module {
  111. sourceDirs += file("src");
  112. scopes = [ COMPILE: [plus:[project.configurations.compile]]]
  113.  
  114. iml {
  115. withXml {
  116. def node = it.asNode()
  117. def builder = NodeBuilder.newInstance();
  118. builder.current = node;
  119. builder.component(name: "FacetManager") {
  120. facet(type: "android", name: "Android") {
  121. configuration {
  122. option(name: "UPDATE_PROPERTY_FILES", value:"true")
  123. }
  124. }
  125. }
  126. }
  127. }
  128. }
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement