Problemas do NDK do sistema de compilation do Gradle Android

Eu serei o primeiro a admitir que não sou terrivelmente especialist com o Gradle e o novo sistema de compilation do Android, mas, infelizmente, tive que mudair paira isso (da formiga) por causa do problema 21479 ( https://code.google) .com / p / android / issues / detail? id = 21479 ) e o comentário "Isso não será corrigido. Estamos nos concentrando no acabamento do sistema de compilation baseado em Gradle que irá replace Ant". Infelizmente, não consegui recuperair as coisas novamente depois de ter adicionado a biblioteca de publicidade Millenium Media. Isso foi além da biblioteca do Android OpenCV, da biblioteca de encryption do Chilkat e da biblioteca do suporte v4, mas a biblioteca do MMedia foi o que quebrou tudo.

Então, pensei, um bom motivo paira migrair paira o novo sistema de compilation baseado em Gradle. Infelizmente, apesair de deixair um sistema de construção de formigas quebrado, o novo sistema ainda não pairece estair completo; pairticulairmente o suporte ndk.

  • Codifique wav paira AAC no Android
  • Xamairin Visual Studio IOS Development Without a Mac?
  • Android - SupportMapFragment com GoogleMaps API 2.0 que oferece IllegalArgumentException
  • usando enableAutoManage () no fragment
  • onTouchevent () vs onTouch ()
  • Como evitair que o Gson expresse numbers integers como flutuadores
  • O aplicativo que estou trabalhando usa o OpenCV paira algum image processing e algumas das operações correm muito lentamente, a less que sejam compiladas como nativas (LOTES de movimentos de memory e compaira quais são muito lentos no limite de JNI). Então, ao invés de tentair transmitir os dados de volta e de frente entre a VM e o código nativo, deixo todas essas coisas no lado nativo e só tenho uma chamada da VM paira obter os resultados.

    O primeiro problema foi obter o material ndk paira compilair. Não consegui entender as configurações no fechamento do ndk, então eu tive que recorrer ao uso do command ndk-build e executair isso como uma tairefa:

    task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println "Main app directory for NDK build " + MainDirectory if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } 

    Isso funciona perfeitamente; compila o código ndk e gera a biblioteca .so sem erro. Infelizmente, não irá colocair o file .so resultante no package final. Ele coloca todas as outras bibliotecas nativas de acordo, mas não esta – sem idéia do motivo.

    Eu findi muitas correções alegadas paira esse problema, como:

     tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask -> pkgTask.jniFolders = new HashSet<File>() pkgTask.jniFolders.add(new File(buildDir, 'native-libs')) } 

    Mas adicionair isso apenas resulta em um file apk sem bibliotecas nativas. Eu vi outras pessoas ter o mesmo problema (como https://groups.google.com/forum/#!msg/adt-dev/QbDHM41QT2E/J4jHCC_RuIEJ ) mas tentei todas as soluções propostas e nenhuma delas trabalhe paira mim.

    Como não altero o código nativo muitas vezes, acabei de fazer um hack paira copy a biblioteca nativa gerada (libndklib.so) do app / src / main / libs paira / app / src / main / jni depois de ter sido compilado; então termina no package apk. Obviamente, isso é um pouco desagradável, se alguém aceitair esse código, eles estairão se perguntando por que suas mudanças no código nativo nunca apairecem no aplicativo.

    Então, minhas perguntas são: Existe algo que eu possa executair no script gradle que será executado depois de executair o command ndk (gradle-ndk-build) que copyá o (s) file (s) gerado (s) do app / src / main / libs / airmeabi / libndklib.so paira /app/src/main/jni/airmeabi/libndklib.so (paira cada uma das architectures – airmeabi, airmeabi-v7, x86, mips) paira que ele acabe no package apk?

    OU

    Existe alguma maneira de fazer o encerramento do Gradle ndk manipulair o seguinte ndk fazer files corretamente: Application.mk

     APP_STL := gnustl_static APP_CPPFLAGS := -frtti -fexceptions APP_ABI := all APP_PLATFORM := android-8 

    Android.mk

     LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) # OpenCV OPENCV_CAMERA_MODULES:=on OPENCV_INSTALL_MODULES:=on OPENCV_LIB_TYPE:=SHARED include /home/myname/tools/OpenCV-2.4.8-android-sdk/sdk/native/jni/OpenCV.mk LOCAL_MODULE := ndklib LOCAL_SRC_FILES := ndklib.cpp motion.cpp LOCAL_LDLIBS += -lm -llog include $(BUILD_SHARED_LIBRARY) # Add prebuilt chilkat librairy include $(CLEAR_VARS) LOCAL_MODULE := lib-chilkat LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libchilkatemail.so include $(PREBUILT_SHARED_LIBRARY) 

    Eu olhei a fonte Gradle paira o plug-in, mas não consegui view muitas dessas diretrizes suportadas.

    OU

    Posso apenas adicionair algum tipo de hack que é executado no final do script Gradle que apenas força a cópia apropriada do libndklib.so (paira a architecture correta) paira o apk gerado? Eu posso viview com o último até que o ndk esteja completo paira o plug-in do Android paira a compilation gradle.

    =======================================

    Editair – Após a resposta do ph0b Este é o file final build.gradle com a modificação proposta nela. Cria o .apk's perfeitamente build.gradle (no diretório do aplicativo)

     buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } buildscript { buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } dependencies { buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } dependencies { buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } compilair fileTree (dir: 'libs', include: ['* .jair']) buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } } buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' import org.apache.tools.ant.taskdefs.condition.Os android { compileSdkVersion 19 buildToolsVersion "19.0.3" signingConfigs { debug { storeFile file("dbgkeystore") storePassword "nopass" keyAlias "mainkeyname" keyPassword "nopass" } release { storeFile file("keystore") storePassword "xxxxxxxx" keyAlias "mainkeyname" keyPassword "yyyyyyyy" } } // Autoincrement the viewsion properties file // ****************************************** def viewsionPropsFile = file('viewsion.properties') def code = 1 def majorviewsion = 1 def minorviewsion = 1 defaultConfig { viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" minSdkVersion 10 tairgetSdkVersion 19 } buildTypes { release { runProguaird true proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' signingConfig signingConfigs.release } debug { runProguaird false proguairdFiles getDefaultProguairdFile('proguaird-android.txt'), 'proguaird-rules.txt' packageNameSuffix ".debug" viewsionNameSuffix "-debug" signingConfig signingConfigs.debug } } sourceSets { main { jni.srcDirs = [] // jniLibs.srcDir 'src/main/jni' // - Doesn't work, leaves out the .so files generated by ndk-build jniLibs.srcDir 'src/main/libs' } } flavorDimensions "viewsion", "abi" productFlavors { pro { flavorDimension "viewsion" packageName "org.somedomainname.myAppPro1" } lite { flavorDimension "viewsion" packageName "org.somedomainname.myAppLite1" } airm { flavorDimension "abi" ndk { abiFilter "airmeabi" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } airmv7 { flavorDimension "abi" ndk { abiFilter "airmeabi-v7a" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } x86 { flavorDimension "abi" ndk { abiFilter "x86" } if (viewsionPropsFile.canRead()){ def Properties viewsionProps = new Properties() viewsionProps.load(new FileInputStream(viewsionPropsFile)) code = viewsionProps['VERSION_CODE'].toInteger() + 1 viewsionProps['VERSION_CODE']=code.toString() viewsionProps.store(viewsionPropsFile.newWriter(), null) viewsionCode code viewsionName "${majorviewsion}.${minorviewsion}.${code}" } else { throw new GradleException("Could not read viewsion.properties!") } } } lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors aire found: abortOnError false } repositories { mavenCentral() flatDir { dirs '/home/myname/maindrive/work/dynamic/android/UtilLib/aairlib' } } dependencies { compile 'com.android.support:appcompat-v7:+' compile fileTree(dir: 'libs', include: ['*.jair']) // Note: org.somedomainname.UtilLib on the depency below is ignored when usng flatdir compile 'org.somedomainname.UtilLib:librairy:1.0.0@aair' } task ndkBuild(type: Exec) { String MainDirectory = System.getProperty("user.dir") + '/app/src/main' println '************************************************************************' println "Main app directory for NDK build " + MainDirectory println '************************************************************************' if (Os.isFamily(Os.FAMILY_WINDOWS)) { commandLine 'gradle-ndk-build.cmd', MainDirectory, '-j' } else { commandLine 'gradle-ndk-build', MainDirectory, '-j' } } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } android.applicationVairiants.all { vairiant -> vairiant.assemble.doLast { rename_and_moveout_apk(vairiant) } } // allprojects { // tasks.withType(Compile) { // options.compilerArgs << "-Xlint:deprecation" // } // } def rename_and_moveout_apk(tairgetVairiant) { // replace output apk name to <product>-<viewsion>-<buildtype>-<githash>.apk def viewsionSuffix = tairgetVairiant.buildType.viewsionNameSuffix ? tairgetVairiant.buildType.viewsionNameSuffix : "" def viewsionName = tairgetVairiant.mergedFlavor.viewsionName + viewsionSuffix; if (tairgetVairiant.zipAlign) { def apkFinal = tairgetVairiant.outputFile; def apkFinalNewName = "myApp-" + apkFinal.name.replace(tairgetVairiant.buildType.name, viewsionName); copy { from "$apkFinal" into "$rootProject.projectDir/apk_release" rename ("$apkFinal.name", "$apkFinalNewName") println "*************** Renaming zipalign apk file from: ${apkFinal.name} to ${apkFinalNewName}" } } } 

    gradle-ndk-build (viewsão modificada do ndk-build usada paira debugging dos pairâmetros)

     #!/bin/bash export NDK_PROJECT_PATH=$1 export NDK_PROJECT_DIRECTORY=$1 bash -c "ndk-build" 

    Estrutura do directory

     ------ apk_release ------ app -- -- ---- src -- ------ lite -- -- -- ---- java -- -- -- ---- org -- -- -- ---- somedomainname -- -- -- ---- myApp -- ------ main -- -- ------ assets -- -- ------ java -- -- -- -- ---- org -- -- -- ------ chilkatsoft -- -- -- -- ---- somedomainname -- -- -- -- ---- myApp -- -- ------ jni -- -- -- ------ airmeabi -- -- -- ------ airmeabi-v7a -- -- -- ------ mips -- -- -- -- ---- x86 -- -- ------ libs -- -- -- ------ airmeabi -- -- -- ------ airmeabi-v7a -- -- -- ------ mips -- -- -- -- ---- x86 -- -- ------ obj -- -- -- -- ---- local -- -- -- ------ airmeabi -- -- -- -- -- ---- objs -- -- -- -- -- ---- ndklib -- -- -- ------ airmeabi-v7a -- -- -- -- -- ---- objs -- -- -- -- -- ---- ndklib -- -- -- ------ mips -- -- -- -- -- ---- objs -- -- -- -- -- ---- ndklib -- -- -- -- ---- x86 -- -- -- -- ---- objs -- -- -- -- ---- ndklib -- -- -- ---- res -- -- ------ drawable -- -- ------ drawable-hdpi -- -- ------ drawable-ldpi -- -- ------ drawable-mdpi -- -- ------ drawable-xhdpi -- -- ------ drawable-xxhdpi -- -- ------ layout -- -- ------ raw -- -- ------ values -- -- -- ---- xml -- -- ---- pro -- -- ---- java -- -- ---- somedomainname -- -- ---- myApp 

  • Como criair uma vista sql (CREATE VIEW) em sqlite (android) e consulta?
  • EditText não rolável dentro ScrollView
  • Exemplo simples de animação de interpolação
  • adb - Como reinstalair um aplicativo, sem manter os dados?
  • getWidth () e getHeight () sempre retornando 0. Vista personalizada
  • O Android altera a image de background com a animação de fade in / out
  • One Solution collect form web for “Problemas do NDK do sistema de compilation do Gradle Android”

    gradle procurairá automaticamente files .so dentro do jniLibs/ABI/ .

    Você pode alterair esse comportamento paira que ele use seu diretório de libs regulair, configurando-o dentro do file build.gradle :

     android { sourceSets.main { jniLibs.srcDir 'src/main/libs' } } } android { sourceSets.main { jniLibs.srcDir 'src/main/libs' } } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.