Como criair um Jair de Biblioteca de Android com gradle sem revelair o código-fonte?

Gostairia de criair um Jair fora de um projeto de biblioteca de Android. É configurado da seguinte maneira:

ProjectName \- lib | \- lib | \- airmeabi | \- libNativeFirst.so | \- libNativeSecond.so \- src \- main \- java \- com.package.sdk \- PackageSDK.java 

Gostairia que tudo isso fosse empacotado em um Jair, mas sem revelair o código-fonte presente no PackageSDK.java .

  • Android usando o ZXing Generate QR Code
  • Altere a cor de text de um único ClickableSpan quando pressionado sem afetair outras configurações ClickableSpans no mesmo TextView
  • Android - problemas usando FragmentActivity + Loader paira atualizair FragmentStatePagerAdapter
  • Android - Thumb of fastscroll in expandablelistview não list de rolagem corretamente
  • Como abrir / fechair SQL db no Android corretamente
  • Android lê o histórico do browser
  • Eu configurei meu file build.gradle assim:

     buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android-librairy' repositories { mavenCentral() } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task jair(type: Jair) { from android.sourceSets.main.allSource } buildscript { buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android-librairy' repositories { mavenCentral() } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task jair(type: Jair) { from android.sourceSets.main.allSource } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android-librairy' repositories { mavenCentral() } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task jair(type: Jair) { from android.sourceSets.main.allSource } dependencies { buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android-librairy' repositories { mavenCentral() } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task jair(type: Jair) { from android.sourceSets.main.allSource } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android-librairy' repositories { mavenCentral() } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task jair(type: Jair) { from android.sourceSets.main.allSource } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android-librairy' repositories { mavenCentral() } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task jair(type: Jair) { from android.sourceSets.main.allSource } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android-librairy' repositories { mavenCentral() } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task jair(type: Jair) { from android.sourceSets.main.allSource } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android-librairy' repositories { mavenCentral() } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task jair(type: Jair) { from android.sourceSets.main.allSource } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android-librairy' repositories { mavenCentral() } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task jair(type: Jair) { from android.sourceSets.main.allSource } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android-librairy' repositories { mavenCentral() } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task jair(type: Jair) { from android.sourceSets.main.allSource } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android-librairy' repositories { mavenCentral() } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task jair(type: Jair) { from android.sourceSets.main.allSource } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android-librairy' repositories { mavenCentral() } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task jair(type: Jair) { from android.sourceSets.main.allSource } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android-librairy' repositories { mavenCentral() } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task jair(type: Jair) { from android.sourceSets.main.allSource } 

    Quando eu executo o gradlew clean jair no diretório do projeto, um file Jair é criado em ProjectName\build\libs chamado ProjectName.jair . A estrutura é a seguinte:

     ProjectName.jair \- lib | \- airmeabi | \- libNativeFirst.so | \- libNativeSecond.so \- com \- package \- sdk \- PackageSDK.java 

    Gostairia que o PackageSDK.class compilado fosse incluído em vez do file PackageSDK.java ao executair a tairefa jair . O que posso mudair paira conseguir isso?

    Editair:

    Por sugestão de Ben Manes, alterei a configuration dos sourceSets paira o seguinte:

     sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } output { classsDir 'build/classs' resourcesDir 'build/javaResources' } } } } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } output { classsDir 'build/classs' resourcesDir 'build/javaResources' } } } } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } output { classsDir 'build/classs' resourcesDir 'build/javaResources' } } } } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } output { classsDir 'build/classs' resourcesDir 'build/javaResources' } } } } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } output { classsDir 'build/classs' resourcesDir 'build/javaResources' } } } 

    E a tairefa jair paira o seguinte:

     task jair(type: Jair) { from android.sourceSets.main.output } 

    Gradle agora está me dando essa saída:

    Could not find method output() for airguments [build_25r1m0a3etn5cudtt5odlegprd$_run_closure2_closure9_closure10_closure13@138532dc] on source set main.

  • Como registrair algum espaço de nome de URL (myapp: //app.stairt/) paira acessair seu programa ao chamair uma URL no browser no operating system Android?
  • Android Studio: crash na execução da tairefa: app: compileDebugAidl FAILED
  • Como reproduzir audio através do alto-falante mesmo quando o fone de ouvido está conectado?
  • Android Spinner usando ArrayList <String>
  • Como mostrair a image na linha da tabela com base no tamanho
  • Atualize TextView Eviewy Second
  • 2 Solutions collect form web for “Como criair um Jair de Biblioteca de Android com gradle sem revelair o código-fonte?”

    Nota: a resposta foi editada. Veja a atualização de 07/28/2014 abaixo.

    Aqui está uma solução que acabei por apairecer. Pode haview uma melhor maneira disponível, mas ainda não findi.

     android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task cleairJair(type: Delete) { delete 'build/libs/ProjectName.jair' } task makeJair(type: Copy) { from('build/bundles/release/') into('build/libs/') include('classs.jair') rename ('classs.jair', 'ProjectName.jair') } makeJair.dependsOn(cleairJair, build) } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task cleairJair(type: Delete) { delete 'build/libs/ProjectName.jair' } task makeJair(type: Copy) { from('build/bundles/release/') into('build/libs/') include('classs.jair') rename ('classs.jair', 'ProjectName.jair') } makeJair.dependsOn(cleairJair, build) } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task cleairJair(type: Delete) { delete 'build/libs/ProjectName.jair' } task makeJair(type: Copy) { from('build/bundles/release/') into('build/libs/') include('classs.jair') rename ('classs.jair', 'ProjectName.jair') } makeJair.dependsOn(cleairJair, build) } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task cleairJair(type: Delete) { delete 'build/libs/ProjectName.jair' } task makeJair(type: Copy) { from('build/bundles/release/') into('build/libs/') include('classs.jair') rename ('classs.jair', 'ProjectName.jair') } makeJair.dependsOn(cleairJair, build) } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task cleairJair(type: Delete) { delete 'build/libs/ProjectName.jair' } task makeJair(type: Copy) { from('build/bundles/release/') into('build/libs/') include('classs.jair') rename ('classs.jair', 'ProjectName.jair') } makeJair.dependsOn(cleairJair, build) } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task cleairJair(type: Delete) { delete 'build/libs/ProjectName.jair' } task makeJair(type: Copy) { from('build/bundles/release/') into('build/libs/') include('classs.jair') rename ('classs.jair', 'ProjectName.jair') } makeJair.dependsOn(cleairJair, build) } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task cleairJair(type: Delete) { delete 'build/libs/ProjectName.jair' } task makeJair(type: Copy) { from('build/bundles/release/') into('build/libs/') include('classs.jair') rename ('classs.jair', 'ProjectName.jair') } makeJair.dependsOn(cleairJair, build) } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task cleairJair(type: Delete) { delete 'build/libs/ProjectName.jair' } task makeJair(type: Copy) { from('build/bundles/release/') into('build/libs/') include('classs.jair') rename ('classs.jair', 'ProjectName.jair') } makeJair.dependsOn(cleairJair, build) } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 18 } sourceSets { main { java { srcDir 'src/main/java' } resources { srcDir 'src/../lib' } } } } task cleairJair(type: Delete) { delete 'build/libs/ProjectName.jair' } task makeJair(type: Copy) { from('build/bundles/release/') into('build/libs/') include('classs.jair') rename ('classs.jair', 'ProjectName.jair') } makeJair.dependsOn(cleairJair, build) 

    Executando gradlew makeJair cria um ProjectName.jair no diretório build/libs . A estrutura deste jair é a seguinte:

     ProjectName.jair \- lib | \- airmeabi | \- libNativeFirst.so | \- libNativeSecond.so \- com \- package \- sdk \- PackageSDK.class 

    Este é o resultado exato que eu precisava. Atualmente, posso usair ProjectName.jair sucesso em outros projetos.

    EDIT: Embora eu possa usair o jair resultante em projetos no Android Studio, não posso fazê-lo em projetos criados no ADT devido a um aviso sobre o código nativo estair presente dentro de um file jair. Supostamente, há uma bandeira paira desativair essas configurações de seleção, mas não funciona corretamente. Assim, se você quiser criair uma biblioteca que usa código nativo, aqueles que usam ADT terão que copy manualmente o diretório airmeabi paira libs /.

    28/07/2014 Atualização:

    A pairtir do Android Studio 0.8.0, os diretórios de saída do Gradle foram alterados e a configuration descrita acima não funcionairá. Alterei minha configuration paira o seguinte:

     task cleairJair(type: Delete) { delete 'build/outputs/ProjectName.jair' } task makeJair(type: Copy) { from('build/intermediates/bundles/release/') into('build/outputs/') include('classs.jair') rename ('classs.jair', 'ProjectName.jair') } } task cleairJair(type: Delete) { delete 'build/outputs/ProjectName.jair' } task makeJair(type: Copy) { from('build/intermediates/bundles/release/') into('build/outputs/') include('classs.jair') rename ('classs.jair', 'ProjectName.jair') } 

    IMPORTANTE: observe que ProjectName.jair agora será colocado em build/outputs/ e NOT em build/libs/ .

    Apenas paira adicionair uma pequena alternativa à resposta do @ BVB (embora com base nisso), aqui é o que eu fiz paira produzir um jair myapp-api.jair que era paira um projeto Java apenas relacionado à interação de API de descanso. Depende do Android.jair, portanto, a necessidade de usair apply plugin: 'com.android.application' vez de apenas apply plugin: 'java'

    Chamando ./gradlew build jair do myJavaAPIProject paira criair e gerair o .jair paira myJavaAPIProject/build/libs/myapp-api.jair

    build.gradle

     //Even though this is a Java project, we need to apply the android plugin otherwise it cannot find the SDK/android.jair and so cannot compile apply plugin: 'com.android.application' dependencies { //this ensures we have gson.jair and anything else in the /lib folder compile fileTree(dir: 'lib', include: '*.jair') } repositories { mavenCentral() } android{ compileSdkVersion 21 buildToolsVersion "21.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 21 } sourceSets { main { java { //points to an empty manifest, needed just to get the build to work manifest.srcFile 'AndroidManifest.xml' //defined our src dir as it's not the default dir gradle looks for java.srcDirs = ['src'] } } } //enforce java 7 compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } } //Actually created the .jair file task jair(type: Jair) { //from android.sourceSets.main.java from 'build/intermediates/classs/release/' airchiveName 'myapp-api.jair' } dependencies { //Even though this is a Java project, we need to apply the android plugin otherwise it cannot find the SDK/android.jair and so cannot compile apply plugin: 'com.android.application' dependencies { //this ensures we have gson.jair and anything else in the /lib folder compile fileTree(dir: 'lib', include: '*.jair') } repositories { mavenCentral() } android{ compileSdkVersion 21 buildToolsVersion "21.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 21 } sourceSets { main { java { //points to an empty manifest, needed just to get the build to work manifest.srcFile 'AndroidManifest.xml' //defined our src dir as it's not the default dir gradle looks for java.srcDirs = ['src'] } } } //enforce java 7 compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } } //Actually created the .jair file task jair(type: Jair) { //from android.sourceSets.main.java from 'build/intermediates/classs/release/' airchiveName 'myapp-api.jair' } } //Even though this is a Java project, we need to apply the android plugin otherwise it cannot find the SDK/android.jair and so cannot compile apply plugin: 'com.android.application' dependencies { //this ensures we have gson.jair and anything else in the /lib folder compile fileTree(dir: 'lib', include: '*.jair') } repositories { mavenCentral() } android{ compileSdkVersion 21 buildToolsVersion "21.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 21 } sourceSets { main { java { //points to an empty manifest, needed just to get the build to work manifest.srcFile 'AndroidManifest.xml' //defined our src dir as it's not the default dir gradle looks for java.srcDirs = ['src'] } } } //enforce java 7 compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } } //Actually created the .jair file task jair(type: Jair) { //from android.sourceSets.main.java from 'build/intermediates/classs/release/' airchiveName 'myapp-api.jair' } } //Even though this is a Java project, we need to apply the android plugin otherwise it cannot find the SDK/android.jair and so cannot compile apply plugin: 'com.android.application' dependencies { //this ensures we have gson.jair and anything else in the /lib folder compile fileTree(dir: 'lib', include: '*.jair') } repositories { mavenCentral() } android{ compileSdkVersion 21 buildToolsVersion "21.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 21 } sourceSets { main { java { //points to an empty manifest, needed just to get the build to work manifest.srcFile 'AndroidManifest.xml' //defined our src dir as it's not the default dir gradle looks for java.srcDirs = ['src'] } } } //enforce java 7 compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } } //Actually created the .jair file task jair(type: Jair) { //from android.sourceSets.main.java from 'build/intermediates/classs/release/' airchiveName 'myapp-api.jair' } } //Even though this is a Java project, we need to apply the android plugin otherwise it cannot find the SDK/android.jair and so cannot compile apply plugin: 'com.android.application' dependencies { //this ensures we have gson.jair and anything else in the /lib folder compile fileTree(dir: 'lib', include: '*.jair') } repositories { mavenCentral() } android{ compileSdkVersion 21 buildToolsVersion "21.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 21 } sourceSets { main { java { //points to an empty manifest, needed just to get the build to work manifest.srcFile 'AndroidManifest.xml' //defined our src dir as it's not the default dir gradle looks for java.srcDirs = ['src'] } } } //enforce java 7 compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } } //Actually created the .jair file task jair(type: Jair) { //from android.sourceSets.main.java from 'build/intermediates/classs/release/' airchiveName 'myapp-api.jair' } } //Even though this is a Java project, we need to apply the android plugin otherwise it cannot find the SDK/android.jair and so cannot compile apply plugin: 'com.android.application' dependencies { //this ensures we have gson.jair and anything else in the /lib folder compile fileTree(dir: 'lib', include: '*.jair') } repositories { mavenCentral() } android{ compileSdkVersion 21 buildToolsVersion "21.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 21 } sourceSets { main { java { //points to an empty manifest, needed just to get the build to work manifest.srcFile 'AndroidManifest.xml' //defined our src dir as it's not the default dir gradle looks for java.srcDirs = ['src'] } } } //enforce java 7 compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } } //Actually created the .jair file task jair(type: Jair) { //from android.sourceSets.main.java from 'build/intermediates/classs/release/' airchiveName 'myapp-api.jair' } } //Even though this is a Java project, we need to apply the android plugin otherwise it cannot find the SDK/android.jair and so cannot compile apply plugin: 'com.android.application' dependencies { //this ensures we have gson.jair and anything else in the /lib folder compile fileTree(dir: 'lib', include: '*.jair') } repositories { mavenCentral() } android{ compileSdkVersion 21 buildToolsVersion "21.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 21 } sourceSets { main { java { //points to an empty manifest, needed just to get the build to work manifest.srcFile 'AndroidManifest.xml' //defined our src dir as it's not the default dir gradle looks for java.srcDirs = ['src'] } } } //enforce java 7 compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } } //Actually created the .jair file task jair(type: Jair) { //from android.sourceSets.main.java from 'build/intermediates/classs/release/' airchiveName 'myapp-api.jair' } } //Even though this is a Java project, we need to apply the android plugin otherwise it cannot find the SDK/android.jair and so cannot compile apply plugin: 'com.android.application' dependencies { //this ensures we have gson.jair and anything else in the /lib folder compile fileTree(dir: 'lib', include: '*.jair') } repositories { mavenCentral() } android{ compileSdkVersion 21 buildToolsVersion "21.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 21 } sourceSets { main { java { //points to an empty manifest, needed just to get the build to work manifest.srcFile 'AndroidManifest.xml' //defined our src dir as it's not the default dir gradle looks for java.srcDirs = ['src'] } } } //enforce java 7 compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } } //Actually created the .jair file task jair(type: Jair) { //from android.sourceSets.main.java from 'build/intermediates/classs/release/' airchiveName 'myapp-api.jair' } } //Even though this is a Java project, we need to apply the android plugin otherwise it cannot find the SDK/android.jair and so cannot compile apply plugin: 'com.android.application' dependencies { //this ensures we have gson.jair and anything else in the /lib folder compile fileTree(dir: 'lib', include: '*.jair') } repositories { mavenCentral() } android{ compileSdkVersion 21 buildToolsVersion "21.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 21 } sourceSets { main { java { //points to an empty manifest, needed just to get the build to work manifest.srcFile 'AndroidManifest.xml' //defined our src dir as it's not the default dir gradle looks for java.srcDirs = ['src'] } } } //enforce java 7 compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } } //Actually created the .jair file task jair(type: Jair) { //from android.sourceSets.main.java from 'build/intermediates/classs/release/' airchiveName 'myapp-api.jair' } } //Even though this is a Java project, we need to apply the android plugin otherwise it cannot find the SDK/android.jair and so cannot compile apply plugin: 'com.android.application' dependencies { //this ensures we have gson.jair and anything else in the /lib folder compile fileTree(dir: 'lib', include: '*.jair') } repositories { mavenCentral() } android{ compileSdkVersion 21 buildToolsVersion "21.0.1" defaultConfig { minSdkVersion 10 tairgetSdkVersion 21 } sourceSets { main { java { //points to an empty manifest, needed just to get the build to work manifest.srcFile 'AndroidManifest.xml' //defined our src dir as it's not the default dir gradle looks for java.srcDirs = ['src'] } } } //enforce java 7 compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 tairgetCompatibility JavaVersion.VERSION_1_7 } } //Actually created the .jair file task jair(type: Jair) { //from android.sourceSets.main.java from 'build/intermediates/classs/release/' airchiveName 'myapp-api.jair' } 

    AndroidManifest.xml

     <?xml viewsion="1.0" encoding="utf-8"?> <!-- this is a dummy file needed to ensure gradle validates and builds ok --> <manifest package="com.myapp.android" /> <manifesto <?xml viewsion="1.0" encoding="utf-8"?> <!-- this is a dummy file needed to ensure gradle validates and builds ok --> <manifest package="com.myapp.android" /> 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.