Unable to make executable signed-release build dexgaurd - android

I updated my project to gradle version to 4.0 and android support version library to latest(i.e. 27.0.0) with target api with Android O(26), and made a signed release build.
Now I'm getting this crash when open the app:
java.lang.IllegalAccessError: Method 'boolean android.view.ViewGroup.checkLayoutParams(android.view.ViewGroup$LayoutParams)' is inaccessible to class 'android.support.v7.widget.ActionMenuPresenter' (declaration of 'android.support.v7.widget.ActionMenuPresenter' appears in /data/app/com.myairtelapp-iuW7irEMrfWuoyVjp6OGKA==/base.apk)
at android.support.v7.widget.ActionMenuPresenter.getItemView(:202)
at android.support.v7.widget.ActionMenuPresenter.flagActionItems(:476)
at android.support.v7.view.menu.MenuBuilder.flagActionItems(:1164)
at android.support.v7.view.menu.BaseMenuPresenter.updateMenuView(:95)
at android.support.v7.widget.ActionMenuPresenter.updateMenuView(:229)
at android.support.v7.view.menu.MenuBuilder.dispatchPresenterUpdate(:291)
at android.support.v7.view.menu.MenuBuilder.onItemsChanged(:1051)
at android.support.v7.view.menu.MenuBuilder.startDispatchingItemsChanged(:1078)
at android.support.v7.app.ToolbarActionBar.populateOptionsMenu(:460)
at android.support.v7.app.ToolbarActionBar$1.run(:55)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6809)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)'
My build.gradle is:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'net.researchgate.release'
apply plugin: 'dexguard'
android {
compileSdkVersion project.ext.compile_sdk_version
buildToolsVersion project.ext.build_tools_version
lintOptions {
quiet false
abortOnError false
ignoreWarnings false
disable "ResourceType"
}
dexOptions {
javaMaxHeapSize "4g"
}
signingConfigs {
release {
}
}
flavorDimensions 'channel'
productFlavors {
playstore {
dimension 'channel'
manifestPlaceholders = [channelName: "playstore"]
}
}
configurations {
all {
exclude group: 'org.json', module: 'json'
exclude module: 'httpclient'
exclude module: 'commons-logging'
resolutionStrategy {
force "com.android.support:gridlayout-v7:${support_version}"
force "com.android.support:support-v4:${support_version}"
force "com.android.support:appcompat-v7:${support_version}"
force "com.android.support:cardview-v7:${support_version}"
force "com.android.support:recyclerview-v7:${support_version}"
force "com.android.support:design:${support_version}"
}
}
}
defaultConfig {
applicationId "com.myairtelapp"
minSdkVersion project.ext.min_sdk_version
targetSdkVersion project.ext.target_sdk_version
vectorDrawables.useSupportLibrary = true
versionCode manifestVersionCode
versionName manifestVersionName
buildConfigField BOOLEAN, LOAD_DUMMY_JSON, FALSE
// Config for enbling dummy mode
buildConfigField BOOLEAN, SET_SPOOF_REQUEST, FALSE
// Config for spoofing request
buildConfigField BOOLEAN, REPORT_CRASHES, TRUE
// Flag for reporting crashlytics
multiDexEnabled true
}
buildTypes {
release {
buildConfigField BOOLEAN, LOG_LEVEL_DEBUG, FALSE
signingConfig signingConfigs.release
buildConfigField STRING, S3_URL, BASE_URL_S3_PROD
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFile getDefaultDexGuardFile('dexguard-release.pro')
proguardFile 'dexguard-project.pro'
proguardFile 'proguard-rules.pro'
}
debug {
debuggable true
buildConfigField BOOLEAN, REPORT_CRASHES, FALSE
buildConfigField BOOLEAN, LOG_LEVEL_DEBUG, TRUE
proguardFile getDefaultDexGuardFile('dexguard-debug.pro')
proguardFile 'dexguard-project.pro'
proguardFile 'proguard-rules.pro'
applicationIdSuffix ".debug"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
def gitBranchName() {
return 'git rev-parse --abbrev-ref HEAD'.execute().text.trim()
}
/** generate main build tasks
* generated tasks : [airtelOneDebugAssemble, airtelOneReleaseAssemble, airtelOneStagingAssemble
* airtelOneQaAssemble,airtelOneDummyAssemble]
**/
android.buildTypes.all { buildType ->
android.productFlavors.each { flavor ->
task("airtelOne${flavor.name.capitalize()}${buildType.name.capitalize()}Assemble") {
if (buildType.name == android.buildTypes.release.name) {
dependsOn "release"
} else {
dependsOn "assemble${flavor.name.capitalize()}${buildType.name.capitalize()}"
}
}
}
}
/**
* rename the generated apk.
* use SNAPSHOT for intermediate builds
*/
tasks.whenTaskAdded { task ->
if (task.name == 'generateReleaseBuildConfig') {
task.dependsOn 'updateVersionProperties'
}
}
/*
Override release plugin task and update version properties file.
*/
task('updateVersionProperties') << {
def incVersion = manifestVersionCode + 1
props.setProperty(PropertyVersionCode, incVersion.toString())
def appVersion = manifestVersionName.split("\\.")
def majorVersion = appVersion[0]
def minorVersion = appVersion[1]
def patchVersion = appVersion[2]
def updatePatchVersion = patchVersion.toInteger() + 1
def newVersionName = "${majorVersion}.${minorVersion}.${updatePatchVersion}"
props.setProperty(PropertyVersionName, newVersionName)
def writer = new FileWriter(file(PropertiesFile))
try {
props.store(writer, 'Manifest Version Properties')
writer.flush()
} finally {
writer.close()
}
}
def getDate() {
def date = new Date()
def formattedDate = date.format("dd-MM'T'HH-mm")
return formattedDate
}
repositories {
mavenCentral()
maven { url 'http://dl.bintray.com/amulyakhare/maven' }
maven { url 'https://s3-ap-southeast-1.amazonaws.com/godel-release/godel/' }
maven { url 'https://maven.fabric.io/public' }
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
compile(name: 'GoogleConversionTrackingSdk-2.2.4', ext: 'jar')
compile(name: 'leap_sdk', ext: 'aar')
compile(name: 'SecureComponent-PROD-V1.5', ext: 'aar')
implementation project(':qrcodereaderview')
implementation project(':applib')
compile 'com.android.support:multidex:1.0.3'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.squareup:otto:1.3.8'
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
compile 'com.squareup.okhttp:okhttp:2.7.5'
//compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.7.5'
compile 'commons-codec:commons-codec:20041127.091804'
compile 'com.github.castorflex.smoothprogressbar:library-circular:1.0.0'
compile 'com.birbit:android-priority-jobqueue:1.3'
compile 'com.squareup.wire:wire-runtime:1.6.1'
compile 'com.squareup:tape:1.2.3'
compile('com.crashlytics.sdk.android:crashlytics:2.6.3#aar') {
transitive = true;
}
compile('com.github.ozodrukh:CircularReveal:1.1.1#aar') {
transitive = true;
}
compile('com.moengage:moe-android-sdk:7.7.15') {
exclude group: 'com.moengage', module: 'moe-location-lib'
}
compile ('com.moengage:addon-messaging:1.1.02')
{
exclude group: 'com.android.support'
}
compile 'com.github.bumptech.glide:glide:3.7.0'
compile ('in.juspay:godel:0.6.24.1423')
{
exclude group: 'com.android.support'
}
/* compile ('fr.baloomba:viewpagerindicator:2.4.2')
{
exclude group: 'com.android.support'
}*/
compile 'com.madgag.spongycastle:core:1.54.0.0'
compile 'com.madgag.spongycastle:prov:1.54.0.0'
compile files('libs/secure-component-sdk.jar')
compile 'com.github.PhilJay:MPAndroidChart:v3.0.0'
//Charts lib
compile 'com.github.evgenyneu:js-evaluator-for-android:v2.0.0'
compile "com.android.support:customtabs:${support_version}"
//SafetyNet dependency
compile ("com.google.android.gms:play-services-safetynet:${google_play_services_version}")
{
exclude group: 'com.android.support'
exclude module: 'support-v4'
}
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.appsflyer:af-android-sdk:4.8.8'
compile 'com.android.installreferrer:installreferrer:1.0'
compile ('com.firebase:firebase-jobdispatcher:0.8.5')
{
exclude group: 'com.android.support'
}
}
I checked for duplicate dependencies and remove almost all duplicate dependencies
I didn't find any seemlier question

This is due to the following optimization: method/generalization/class.
I tried to make a release build using the following rule in your dexguard configuration:
-optimizations !method/generalization/class
Its working fine for me

Related

./Gradlew Build is taking 2 hours and 40 minutes - Is there any room for improvement?

The app that we are working on is not very large - most of it is an empty application that gets filled in from various endpoints (server side), but we currently have 18 separate flavors of the app that get built.
The issue is, there will be 78 flavors of the application built and if the build time is linear, we are looking at about 11 hours per ./gradlew build request.
Im not well versed in Gradle at all and I was hoping you guys could help me find some problem areas that might be able to improve our build times
Here is the build.gradle:
apply plugin: 'com.android.application'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'io.fabric'
apply from: '../jacoco.gradle'
apply from: '../flavors.gradle'
apply from: '../autoTasks.gradle'
ext {
applicationName = 'OurApp'
supportLibVersion = '25.3.0'
playServicesVersion = '9.6.1'
}
android {
signingConfigs {
debug {
keyAlias 'key'
keyPassword 'pass'
storeFile file('../file.keystore')
storePassword 'pass'
}
release {
keyAlias 'key'
keyPassword 'pass'
storeFile file('../file.jks')
storePassword 'pass'
}
}
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
vectorDrawables.useSupportLibrary true
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
multiDexEnabled true
}
dataBinding {
enabled true
}
lintOptions {
abortOnError false
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
buildConfigField 'String', 'DFP_NETWORK_ID', '"id"'
buildConfigField 'String', 'YOUTUBE_API_KEY', '"ourkey"'
}
debug {
signingConfig signingConfigs.debug
testCoverageEnabled = true
buildConfigField 'String', 'DFP_NETWORK_ID', '"id"'
buildConfigField 'String', 'YOUTUBE_API_KEY', '"anotherKey"'
}
debuggable.initWith(buildTypes.debug)
debuggable {
testCoverageEnabled = false
}
}
dexOptions {
javaMaxHeapSize "4g"
}
applicationVariants.all { variant ->
if (variant.buildType.name == 'release') {
createZipProguardTask(variant);
}
updateApkName(variant);
}
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
annotationProcessor 'com.bluelinelabs:logansquare-compiler:1.3.7'
annotationProcessor 'com.squareup:javapoet:1.8.0'
annotationProcessor 'com.google.dagger:dagger-compiler:2.7'
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.android.support:design:${supportLibVersion}"
compile "com.android.support:recyclerview-v7:${supportLibVersion}"
compile "com.android.support:support-v13:${supportLibVersion}"
compile "com.android.support:percent:${supportLibVersion}"
compile "com.android.support:preference-v14:${supportLibVersion}"
compile "com.google.android.gms:play-services-gcm:${playServicesVersion}"
compile "com.google.android.gms:play-services-maps:${playServicesVersion}"
compile "com.google.firebase:firebase-core:${playServicesVersion}"
compile "com.google.firebase:firebase-messaging:${playServicesVersion}"
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.roughike:bottom-bar:2.2.0'
compile 'io.reactivex.rxjava2:rxjava:2.0.1'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.l4digital.rxloader:rxloader:2.0.1'
compile 'com.bluelinelabs:logansquare:1.3.7'
compile 'com.github.aurae.retrofit2:converter-logansquare:1.4.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
compile 'com.google.dagger:dagger:2.7'
compile 'com.facebook.stetho:stetho:1.4.2'
compile 'com.facebook.stetho:stetho-okhttp3:1.4.2'
compile('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') {
transitive = true
}
compile(name:'googlemediaframework-release', ext:'aar')
compile "com.google.android.gms:play-services-ads:${playServicesVersion}"
compile "com.google.android.gms:play-services-analytics:${playServicesVersion}"
compile 'com.flurry.android:ads:6.2.0'
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
compile 'com.google.android.exoplayer:exoplayer:r1.5.14'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.okhttp3:logging-interceptor:3.5.0'
debugCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
debuggableCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.squareup.okhttp3:okhttp:3.5.0'
androidTestCompile 'org.mockito:mockito-core:1.10.19'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
androidTestCompile('com.android.support.test:rules:0.5') {
exclude module: 'support-annotations'
}
androidTestCompile (name:'cloudtestingscreenshotter_lib', ext:'aar')
androidTestCompile('com.android.support.test:runner:0.5') {
exclude module: 'support-annotations'
}
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2') {
exclude module: 'support-annotations'
}
compile(name:'MapSDK', ext:'aar')
compile('com.twitter.sdk.android:twitter:2.3.2#aar') {
transitive = true;
}
}
def createZipProguardTask(variant) {
def prefix = project.ext.applicationName;
if (project.hasProperty('buildNumber')) {
prefix += '-' + project.getProperties().get('buildNumber');
}
def taskName = variant.flavorName.substring(0, 1).toUpperCase() + variant.flavorName.substring(1);
task("zipProguard${taskName}", type: Zip) {
archiveName = "${prefix}-${variant.flavorName}-proguard.zip";
from "build/outputs/mapping/${variant.flavorName}/release"
destinationDir file('build/outputs/mapping')
}
}
def updateApkName(variant) {
def prefix = project.ext.applicationName;
if (project.hasProperty('buildNumber')) {
prefix += '-' + project.getProperties().get('buildNumber');
}
variant.outputs.each { output ->
def fileName = output.outputFile.name.replace('app', prefix);
def outputFile = new File(output.outputFile.parent.toString(), fileName.toString());
output.outputFile = outputFile;
}
}
Here is what we have in the gradle properties:
org.gradle.jvmargs=-Xmx4608M -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.daemon=true
Any input would be greatly appreciated - like I said, I'm not well versed in gradle at all, so I'm open to anything.
Thank you in advance
I'm sure you figured something out by now, but just for future googlers -
Android Studio gradle takes too long to build improved the speed of my gradle build drastically. It suggests enabling Offline work in Android Studio by going to file>settings>build, execution, deployment>gradle and checking the "Offline work" option.

Android Wear ClassNotFoundException after gradle update

After updating the project gradle wrapper from 2.14.1 to 3.3 and Android gradle plugin from 2.2.3 to 2.3.1 I have a ClassNotFoundException on the wearable application start.
Notes:
If the wearable app pushed directly from the Android Studio to the watch, and not as the part of the mobile release APK, everything works ok.
On the previous gradle version no exceptions.
Exception:
04-12 15:54:57.824 18000-18000/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.artyom.aa.artyom.android, PID: 18000
java.lang.RuntimeException: Unable to instantiate application com.artyom.aa.artyom.android.MyWearApplication: java.lang.ClassNotFoundException: Didn't find class "com.artyom.aa.artyom.android.MyWearApplication" on path: DexPathList[[zip file "/system/framework/com.google.android.wearable.jar", zip file "/data/app/com.artyom.aa.artyom.android-1/base.apk"],nativeLibraryDirectories=[/data/app/com.artyom.aa.artyom.android-1/lib/arm, /vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:578)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4685)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5422)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.artyom.aa.artyom.android.MyWearApplication" on path: DexPathList[[zip file "/system/framework/com.google.android.wearable.jar", zip file "/data/app/com.artyom.aa.artyom.android-1/base.apk"],nativeLibraryDirectories=[/data/app/com.artyom.aa.artyom.android-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newApplication(Instrumentation.java:981)
at android.app.LoadedApk.makeApplication(LoadedApk.java:573)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4685) 
at android.app.ActivityThread.-wrap1(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5422) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
Suppressed: java.lang.ClassNotFoundException: com.artyom.aa.artyom.android.MyWearApplication
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 12 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
Wearable build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
def serverVersion = project.file("../server_version.txt").text
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.artyom.aa.artyom.android"
minSdkVersion 21
targetSdkVersion 25
versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName
}
signingConfigs {
release {
storeFile file(project.ext.releaseStoreFile)
storePassword project.ext.releaseStorePassword
keyAlias project.ext.releaseKeyAlias
keyPassword project.ext.releaseKeyPassword
}
debug {
storeFile file(project.ext.debugStoreFile)
storePassword project.ext.debugStorePassword
keyAlias project.ext.debugKeyAlias
keyPassword project.ext.debugKeyPassword
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
debug {
signingConfig signingConfigs.release
}
release {
//TODO should be removed in production
multiDexEnabled true
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/MANIFEST.MF'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.google.android.support:wearable:2.0.1'
provided 'com.google.android.wearable:wearable:2.0.1'
compile 'com.google.android.gms:play-services-wearable:10.0.1'
annotationProcessor 'com.google.dagger:dagger-compiler:2.8'
compile 'com.google.dagger:dagger:2.8'
provided 'javax.annotation:jsr250-api:1.0'
compile project(':shared')
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.github.shahar2k5:androidutils:1.0.1'
testCompile 'junit:junit:4.12'
// Rx import
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
compile("com.artyom.aa:smoove-mobile-dto_2.11:$serverVersion") {
transitive = false //do not bring dependant jars
changing = true
}
compile("com.artyom.aa:SmooveMobileLogicLayer:$serverVersion") {
transitive = false //do not bring dependant jars
changing = true
}
compile("com.artyom.aa:SmooveDataModel:$serverVersion") {
changing = true
}
compile 'com.artyom.aa:SmooveLogging:0.0.1-SNAPSHOT'
compile 'org.slf4j:slf4j-api:1.7.21'
compile 'com.github.tony19:logback-android-core:1.1.1-6'
compile('com.github.tony19:logback-android-classic:1.1.1-6') {
// workaround issue #73
exclude group: 'com.google.android', module: 'android'
}
}
Application build.gradle:
apply plugin: 'maven'
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'android-aspectj'
apply plugin: "org.sonarqube"
apply plugin: 'me.tatarka.retrolambda'
def buildVersion = project.file("../version.txt").text
def serverVersion = project.file("../server_version.txt").text
android {
project.group = 'com.artyom.aa'
compileSdkVersion 25
buildToolsVersion "25.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.artyom.aa.artyom.android"
buildConfigField 'String', "PEBBLE_APP_UUID", project.ext.pebbleAppUUID
minSdkVersion 19
targetSdkVersion 22
versionCode 70
multiDexEnabled true
versionName buildVersion
multiDexKeepProguard file("proguard-rules.pro")
ndk {
moduleName "accelerometer_ndk"
// This is the name of the module as defined in jni/Android.mk
cFlags "-DANDROID_NDK -D_DEBUG" // Define some macros
ldLibs "log", "android" //load .so files from ndk's usr\lib
}
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g" //specify the heap size for the dex process
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/maven/com.google.guava/guava/pom.properties'
exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
}
signingConfigs {
release {
storeFile file(project.ext.releaseStoreFile)
storePassword project.ext.releaseStorePassword
keyAlias project.ext.releaseKeyAlias
keyPassword project.ext.releaseKeyPassword
}
debug {
storeFile file(project.ext.debugStoreFile)
storePassword project.ext.debugStorePassword
keyAlias project.ext.debugKeyAlias
keyPassword project.ext.debugKeyPassword
}
}
buildTypes {
release {
buildConfigField 'boolean', "REPORT_CRASHES", 'true'
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(
output.outputFile.parent,
"artyom.apk")
}
}
}
debug {
ndk {
debuggable = true
}
versionNameSuffix "_DEV"
buildConfigField 'boolean', "REPORT_CRASHES", 'false'
minifyEnabled false
debuggable true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(
output.outputFile.parent,
"artyom.apk")
}
}
}
daily {
versionNameSuffix "_" + getDate()
debuggable true //TODO should be removed in production
buildConfigField 'boolean', "REPORT_CRASHES", 'true'
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(
output.outputFile.parent,
"artyom.apk")
}
}
}
}
lintOptions {
abortOnError false
}
sourceSets {
test {
java.srcDirs = ['src/test/java/']
}
}
testOptions {
unitTests.returnDefaultValues = true
}
}
tasks.withType(Test) {
maxParallelForks = 1
}
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:25.1.0'
resolutionStrategy.force 'com.google.guava:guava:20.0'
}
dependencies {
testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'com.squareup.assertj:assertj-android:1.1.0'
testCompile 'org.robolectric:robolectric:3.0'
testCompile 'org.robolectric:shadows-support-v4:3.0'
testCompile 'org.robolectric:shadows-multidex:3.0'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'org.hamcrest:hamcrest-library:1.3'
//Validation dependencies
//Dependency Injection
provided 'org.roboguice:roboblender:3.0.1'
//Logging decencies
compile('com.github.tony19:logback-android-classic:1.1.1-3') {
exclude group: 'com.google.android', module: 'android'
}
compile("com.artyom.aa:SmooveAnalyticsCore:$serverVersion") {
exclude group: 'org.slf4j'
exclude group: 'log4j'
changing = true
}
compile("com.artyom.aa:SmooveAndroidImpl:$serverVersion") {
exclude module: 'SmooveDataModel'
exclude group: 'org.slf4j'
exclude group: 'log4j'
changing = true
}
compile("com.artyom.aa:SmooveDataModel:$serverVersion") {
transitive = false //do not bring dependant jars
changing = true
}
/* TODO: Remove the below jackson dependencies when data model will be in separate jar*/
compile('com.crashlytics.sdk.android:crashlytics:2.4.0#aar') {
transitive = true;
exclude group: 'junit'
}
//Build fix workaround - http://forums.gradle.org/gradle/topics/pom-dependency-excludes-wildcard-excluding-the-dependency-itself
//Caused by Robolectric dependency
compile('org.apache.maven:maven-ant-tasks:2.1.3') {
transitive = false;
}
// Android Wear dependencies
wearApp project(':wear')
compile project(':shared')
compile 'com.google.android.gms:play-services-wearable:10.0.1'
compile 'com.github.shahar2k5:androidutils:1.0.1'
compile 'org.greenrobot:eventbus:3.0.0'
//compile 'com.google.android.gms:play-services-analytics:7.8.0'
compile 'javax.el:javax.el-api:2.2.4'
compile 'org.hibernate:hibernate-validator:5.1.3.Final'
compile 'javax.validation:validation-api:1.1.0.Final'
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.getpebble:pebblekit:3.0.0'
compile 'com.google.android.gms:play-services-analytics:10.0.1'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
compile 'com.jjoe64:graphview:4.0.1'
compile 'joda-time:joda-time:2.3'
compile 'org.roboguice:roboguice:3.0.1'
compile 'com.github.tony19:logback-android-core:1.1.1-3'
compile 'org.slf4j:slf4j-api:1.7.6'
compile("com.artyom.aa:SmooveLogging:$serverVersion") { changing = true }
compile 'com.fasterxml.jackson.core:jackson-databind:2.5.2'
compile 'com.fasterxml.jackson.core:jackson-core:2.5.2'
compile 'com.android.support:support-v4:25.1.0'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
compile 'com.google.guava:guava:20.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:cardview-v7:25.1.0'
}
//tasks.whenTaskAdded { task ->
// if (task.name in ['assembleRelease', 'assembleDaily']) {
// task.dependsOn 'test'
// }
//}
def getDate() {
def date = new Date()
def formattedDate = date.format('yyyy-MM-dd-HHmm')
return formattedDate
}

UnsupportedOperationException The "android" command is no longer included in the SDK

I have project in Kotlin and I have updated Android Studio to 2.3.3 and gradle to 3.3 and build tools to 25.3.1. During building I got this error:
Caused by: java.lang.UnsupportedOperationException: The "android" command is no longer included in the SDK. Any references to it (e.g. by third-party plugins) should be removed.
at com.android.SdkConstants.androidCmdName(SdkConstants.java:1947)
at com.android.SdkConstants$androidCmdName$0.callStatic(Unknown Source)
at com.jakewharton.sdkmanager.internal.AndroidCommand$Real.<init>(AndroidCommand.groovy:21)
at com.jakewharton.sdkmanager.internal.PackageResolver.resolve(PackageResolver.groovy:22)
at com.jakewharton.sdkmanager.internal.PackageResolver$resolve.call(Unknown Source)
at com.jakewharton.sdkmanager.SdkManagerPlugin$_apply_closure2$_closure3.doCall(SdkManagerPlugin.groovy:44)
at com.jakewharton.sdkmanager.SdkManagerPlugin$_apply_closure2$_closure3.doCall(SdkManagerPlugin.groovy)
at com.jakewharton.sdkmanager.SdkManagerPlugin.time(SdkManagerPlugin.groovy:51)
at com.jakewharton.sdkmanager.SdkManagerPlugin$_apply_closure2.doCall(SdkManagerPlugin.groovy:43)
at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy16.afterEvaluate(Unknown Source)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:82)
... 56 more
Gralde file:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
jcenter()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.github.JakeWharton:sdk-manager-plugin:master'
}
}
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'
apply plugin: 'io.fabric'
task increaseBuildStageVersion << {
def versionPropsFileI = file('version.properties')
if (versionPropsFileI.canRead()) {
def Properties versionPropsI = new Properties()
versionPropsI.load(new FileInputStream(versionPropsFileI))
def value = 1
println("INCREASING STAGE VERSION")
def versionBuild = versionPropsI['VERSION_BUILD_STAGE'].toInteger() + value
def codeVersion = versionPropsI['VERSION_CODE_STAGE'].toInteger() + value
versionPropsI['VERSION_BUILD_STAGE'] = versionBuild.toString()
versionPropsI['VERSION_CODE_STAGE'] = codeVersion.toString()
versionPropsI.store(versionPropsFileI.newWriter(), null)
} else {
throw new GradleException("Could not read version.properties!")
}
}
task increaseBuildProductionVersion << {
def versionPropsFileI = file('version.properties')
if (versionPropsFileI.canRead()) {
def Properties versionPropsI = new Properties()
versionPropsI.load(new FileInputStream(versionPropsFileI))
def value = 1
println("INCREASING PRODUCTION VERSION")
def versionBuild = versionPropsI['VERSION_BUILD_PRODUCTION'].toInteger() + value
def codeVersion = versionPropsI['VERSION_CODE_PRODUCTION'].toInteger() + value
versionPropsI['VERSION_BUILD_PRODUCTION'] = versionBuild.toString()
versionPropsI['VERSION_CODE_PRODUCTION'] = codeVersion.toString()
versionPropsI.store(versionPropsFileI.newWriter(), null)
} else {
throw new GradleException("Could not read version.properties!")
}
}
tasks.whenTaskAdded { task ->
if (task.name == 'packageStageRelease') {
task.dependsOn increaseBuildStageVersion
} else if (task.name == 'packageProductionRelease') {
task.dependsOn increaseBuildProductionVersion
}
}
android {
signingConfigs {
release {
.....
}
}
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.fivedottwelve.bonusapp"
minSdkVersion 19
targetSdkVersion 25
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable false
signingConfig signingConfigs.release
def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
def buildTime = new GregorianCalendar().format("dd-MM-yyyy' 'h:mm:ss a Z")
buildConfigField "String", "GIT_SHA", "\"{$gitSha}\""
buildConfigField "String", "BUILD_TIME", "\"{$buildTime}\""
}
debug {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
buildConfigField "String", "GIT_SHA", "\"DEBUG\""
buildConfigField "String", "BUILD_TIME", "\"BUILD_TIME\""
}
}
productFlavors {
development {
versionName "1.0." + getStageVersionName() + "-stage"
versionCode getStageVersionCode()
applicationIdSuffix ".stage"
resValue "string", "app_name", "BonusApp"
buildConfigField('String', 'API_URL', "\"https://fivedottwelve.com/\"")
}
stage {
versionName "1.0." + getStageVersionName() + "-stage"
versionCode getStageVersionCode()
applicationIdSuffix ".stage"
resValue "string", "app_name", "BonusApp"
buildConfigField('String', 'API_URL', "\"https://fivedottwelve.com/\"")
}
production {
versionName "1.0." + getProdVersionName()
versionCode getProdVersionCode()
resValue "string", "app_name", "BonusApp"
buildConfigField('String', 'API_URL', "\"https://fivedottwelve.com/\"")
}
}
dexOptions {
preDexLibraries true
maxProcessCount 6
javaMaxHeapSize "3g"
}
testOptions {
unitTests.all {
// All the usual Gradle options.
testLogging {
jvmArgs '-XX:MaxPermSize=256m'
events "passed", "skipped", "failed", "standardOut", "standardError"
outputs.upToDateWhen { false }
showStandardStreams = true
}
}
}
lintOptions {
disable 'InvalidPackage', 'ContentDescription'
abortOnError false
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
packagingOptions {
exclude 'main/AndroidManifest.xml'
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'LICENSE.txt'
exclude 'LICENSE'
}
}
kapt {
generateStubs = true
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
compile 'com.github.salomonbrys.kotson:kotson:2.5.0'
compile "com.android.support:support-v4:$rootProject.ext.android_support_version"
compile "com.android.support:appcompat-v7:$rootProject.ext.android_support_version"
compile "com.android.support:design:$rootProject.ext.android_support_version"
compile "com.android.support:recyclerview-v7:$rootProject.ext.android_support_version"
compile "com.android.support:cardview-v7:$rootProject.ext.android_support_version"
compile 'com.android.support:multidex:1.0.1'
compile "com.google.android.gms:play-services-base:$rootProject.ext.play_service_version"
compile "com.google.android.gms:play-services-gcm:$rootProject.ext.play_service_version"
kapt "com.google.dagger:dagger-compiler:$rootProject.ext.Dagger_version"
compile "com.google.dagger:dagger:$rootProject.ext.Dagger_version"
compile "io.reactivex:rxjava:$rootProject.ext.RxJava_version"
compile "io.reactivex:rxandroid:$rootProject.ext.RxAndroid_version"
provided 'javax.annotation:jsr250-api:1.0'
compile "com.squareup.okhttp3:okhttp:$rootProject.ext.retrofit_http_version"
compile "com.squareup.okhttp3:okhttp-urlconnection:$rootProject.ext.retrofit_http_version"
compile "com.squareup.okhttp3:logging-interceptor:$rootProject.ext.retrofit_http_version"
compile "com.squareup.retrofit2:retrofit:$rootProject.ext.retorfit_version"
compile "com.squareup.retrofit2:converter-gson:$rootProject.ext.retorfit_version"
compile "com.squareup.retrofit2:adapter-rxjava:$rootProject.ext.retorfit_version"
compile 'com.facebook.android:facebook-android-sdk:4.20.0'
compile 'me.relex:circleindicator:1.2.1#aar'
//glide
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0#aar'
//transitions
compile "com.andkulikov:transitionseverywhere:1.7.0"
//beacons
compile "com.kontaktio:sdk:$rootProject.ext.kontakt_io"
compile('com.crashlytics.sdk.android:crashlytics:2.6.7#aar') {
transitive = true;
}
}
repositories {
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
maven { url 'http://maven.livotovlabs.pro/content/groups/public' }
maven { url 'https://maven.fabric.io/public' }
}
/*
Resolves dependency versions across test and production APKs, specifically, transitive
dependencies. This is required since Espresso internally has a dependency on support-annotations.
*/
configurations.all {
resolutionStrategy.force "com.android.support:support-annotations:$rootProject.ext.android_support_version"
}
/*
All direct/transitive dependencies shared between your test and production APKs need to be
excluded from the test APK! This is necessary because both APKs will contain the same classes. Not
excluding these dependencies from your test configuration will result in an dex pre-verifier error
at runtime. More info in this tools bug: (https://code.google.com/p/android/issues/detail?id=192497)
*/
configurations.compile.dependencies.each { compileDependency ->
println "Excluding compile dependency: ${compileDependency.getName()}"
configurations.androidTestCompile.dependencies.each { androidTestCompileDependency ->
configurations.androidTestCompile.exclude module: "${compileDependency.getName()}"
}
}
I removed apply plugin: 'android-sdk-manager' and it works

Android jack and jill get stuck

I am trying to use Jack-Jill and Java8 for my Android app. Everything is good on my laptop but when I tried to run the project on CircleCI it's getting stuck on
transformClassesWithPreJackPackagedLibrariesForDebug
Here is my build.gradle
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply from: 'test-environment.gradle'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
mavenCentral()
}
allprojects {
repositories {
jcenter()
}
}
android {
dexOptions {
jumboMode = true
javaMaxHeapSize "4g"
}
lintOptions {
abortOnError false // true by default
checkAllWarnings false
checkReleaseBuilds false
ignoreWarnings true // false by default
quiet true // false by default
}
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
applicationId "com.projectname.android"
minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
versionCode 1
versionName "1.0"
renderscriptTargetApi 18
renderscriptSupportModeEnabled true
ndk{
abiFilters "armeabi-v7a"
}
jackOptions {
enabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
packagingOptions {
exclude 'com/androidquery/util/web_image.html'
exclude 'META-INF/maven/com.google.guava/guava/pom.properties'
exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
exclude 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.properties'
exclude 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.xml'
exclude 'META-INF/LICENSE'
}
configurations {
all*.exclude group: 'org.bytedeco', module: 'javacpp-presets'
}
if (System.getenv("CIRCLE")) {
defaultConfig {
versionCode Integer.parseInt(System.getenv("CIRCLE_BUILD_NUM"))
versionName "1.0.30"
}
} else {
defaultConfig {
versionCode 1
versionName "1.0"
}
}
signingConfigs {
debug {
storeFile file("../key.keystore")
storePassword "key"
keyAlias "key"
keyPassword "key"
}
staging {
storeFile file("../key.keystore")
storePassword "key"
keyAlias "key"
keyPassword "key"
}
release {
storeFile file("../key.keystore")
storePassword "key"
keyAlias "key"
keyPassword "key"
}
}
buildTypes {
debug {
ext.betaDistributionNotifications = false
signingConfig signingConfigs.debug
applicationIdSuffix ".dev"
minifyEnabled false
shrinkResources false
debuggable true
proguardFile 'proguard-release.cfg'
testProguardFile 'proguard-release.cfg'
manifestPlaceholders = [providerSuffix: ".dev"]
}
staging {
ext.betaDistributionEmailsFilePath = "staging_distribution_emails.txt"
ext.betaDistributionReleaseNotesFilePath = "release_notes.txt"
signingConfig signingConfigs.staging
applicationIdSuffix ".staging"
shrinkResources false
minifyEnabled true
jniDebuggable false
zipAlignEnabled true
proguardFile 'proguard-release.cfg'
manifestPlaceholders = [providerSuffix: ".staging"]
}
release {
signingConfig signingConfigs.release
shrinkResources false
minifyEnabled true
zipAlignEnabled true
jniDebuggable false
proguardFile 'proguard-release.cfg'
}
}
sourceSets {
main {
jniLibs.srcDirs 'src/main/libs'
jni.srcDirs = []
}
}
// productFlavors {
// all32 { minSdkVersion 15 }
// all64 { minSdkVersion 21 }
// }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':libraries:Instagram')
compile project(':libraries:librestreaming')
compile 'com.android.support:appcompat-v7:' + project.ANDROID_SUPPORT_LIBRARY_VERSION
compile 'com.android.support:cardview-v7:' + project.ANDROID_SUPPORT_LIBRARY_VERSION
compile 'com.android.support:design:' + project.ANDROID_SUPPORT_LIBRARY_VERSION
compile 'com.android.support:support-v13:' + project.ANDROID_SUPPORT_LIBRARY_VERSION
compile 'com.android.support:support-v4:' + project.ANDROID_SUPPORT_LIBRARY_VERSION
compile 'com.android.support:percent:' + project.ANDROID_SUPPORT_LIBRARY_VERSION
compile 'com.google.android.gms:play-services-location:' + project.GMS_VERSION
compile 'com.google.android.gms:play-services-gcm:' + project.GMS_VERSION
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android:flexbox:0.2.3'
compile group: 'com.squareup.retrofit2', name: 'converter-gson', version: '2.1.0'
compile group: 'com.squareup.okhttp3', name: 'logging-interceptor', version: '3.4.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.facebook.device.yearclass:yearclass:1.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'hanks.xyz:smallbang-library:0.1.2'
compile('com.crashlytics.sdk.android:crashlytics:2.6.3#aar') {
transitive = true;
}
compile "com.mixpanel.android:mixpanel-android:4.+"
compile('com.yalantis:ucrop:2.2.0') {
exclude group: 'com.android.support', module: 'appcompat'
}
compile 'com.roughike:bottom-bar:2.0.2'
compile 'com.github.kenglxn.QRGen:android:2.2.0'
compile group: 'com.pubnub', name: 'pubnub', version: '4.0.11'
compile ('io.branch.sdk.android:library:2.+') {
exclude module: 'answers-shim'
}
// dagger2
compile 'com.google.dagger:dagger:2.4'
annotationProcessor 'com.google.dagger:dagger-compiler:2.4'
provided 'javax.annotation:jsr250-api:1.0'
// butterknife
compile 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
compile('com.twitter.sdk.android:twitter:2.0.0#aar') {
transitive = true;
}
}
I use tool build gradle version 2.3.0-alpha1
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0-alpha1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
here is some of what it shows in the log console:
:app:fabricGenerateResourcesDebug:app:fabricGenerateResourcesDebug
> Building 75%:app:generateDebugResources
> Building 75% > :app:mergeDebugResources:app:mergeDebugResources
> Building 75%> Building 76% > :app:processDebugResources:app:processDebugResources
> Building 76%:app:generateDebugSources
> Building 76% > :app:transformClassesWithPreJackPackagedLibrariesForDebug:app:transformClassesWithPreJackPackagedLibrariesForDebug
> Building 76%:app:processDebugJavaRes UP-TO-DATE
> Building 77% > :app:transformResourcesWithMergeJavaResForDebug:app:transformResourcesWithMergeJavaResForDebug
> Building 77% > :app:transformJackWithJackForDebug
Seems that it's stuck like forever when it tried to do something with transformJackWithJackForDebug on 77% of building process and then it reached the build time limit (I set it as 60 mins )
Has anyone faced this problem before? Please suggest.

How do I use SVGs in android correctly?

I know that official support for SVG didn't start until api level 23, but how do I use it in an app with the min sdk at 17?
I have had it working before, and I don't know what changed. I am using AndroidSVG library.
I get this error when I try to build a production APK
Error:(163) Error: Expected resource of type drawable [ResourceType]
Here is one of the 150 lines of code that I get this error in
socialTypeImage.setImageResource(R.raw.icon_other_blue);
I don't know what other info to provide, so if you need more, please let me know.
Thanks
I don't know if my problem is a duplicate, but if it is, none of those solutions work.
buildscript {
repositories {
mavenCentral()
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
maven { url 'http://repository.codehaus.org' }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0-alpha1'
//classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.14.7'
classpath 'com.google.code.ksoap2-android:ksoap2-android:3.1.1'
classpath 'org.codehaus.groovy.modules.http-builder:http-builder:0.5.2'
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
maven { url "https://repo.commonsware.com.s3.amazonaws.com" }
maven { url "http://repository.codehaus.org" }
maven { url 'https://maven.fabric.io/public' }
}
import groovyx.net.http.HTTPBuilder
def getBuildNumber(projectName) {
def http = new HTTPBuilder('http://eco-crossbar-620.appspot.com')
try {
def resp = http.get(path: "/${projectName}")
println "NEW BUILD NUMBER: ${resp.BODY}"
resp.BODY
} catch (ignored) {
println "ERROR RETRIEVING BUILD NUMBER"
0
}
}
def getWorkingBranch() {
def workingBranch = "build"
try {
workingBranch = """git --git-dir=${rootDir}/.git
--work-tree=${rootDir}/
rev-parse --abbrev-ref HEAD""".execute().text.trim()
} catch (ignored) {
// git unavailable or incorrectly configured
}
println "Working branch: " + workingBranch
return workingBranch.replaceAll("/", "-")
}
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 23
buildToolsVersion '23.0.2'
def build = getBuildNumber("lookcounter-android")
defaultConfig {
applicationId "com.lookcounter"
minSdkVersion 17
targetSdkVersion 23
versionCode 67
versionName "0.1.$versionCode"
vectorDrawables.useSupportLibrary = true
buildConfigField "String", "DEFAULT_USERNAME", "\"\""
buildConfigField "String", "DEFAULT_PASSWORD", "\"\""
resValue "string", "base64_encoded_public_key", "key"
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "String", "DEFAULT_USERNAME", "\"\""
buildConfigField "String", "DEFAULT_PASSWORD", "\"\""
debuggable false
jniDebuggable false
renderscriptDebuggable false
pseudoLocalesEnabled false
}
debug {
minifyEnabled false
debuggable true
jniDebuggable true
renderscriptDebuggable true
pseudoLocalesEnabled true
zipAlignEnabled false
}
}
signingConfigs {
dev {
storeFile file("../LookCounter.keystore")
storePassword "izpa55word"
keyAlias "lookcounterkey"
}
prod {
storeFile file("../LookCounter.keystore")
keyAlias "lookcounterprodkey"
}
}
productFlavors {
production {
buildConfigField "boolean", "DEV_BUILD", "false"
resValue "string", "app_name", "Lookcounter"
signingConfig signingConfigs.prod
versionCode 2
minSdkVersion 17
targetSdkVersion 23
}
dev {
buildConfigField "boolean", "DEV_BUILD", "true"
resValue "string", "app_name", "(DEV) Lookcounter"
signingConfig signingConfigs.dev
applicationId 'com.lookcounter'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
android.applicationVariants.all { variant ->
if (variant.buildType.name.equals("release")) {
variant.assemble.doLast {
def apkName
def dirName = System.getProperty("user.home") + "/Desktop/lookcounter/apk"
if (variant.name.contains("production")) {
dirName += "PlayStore"
apkName = "Lookcounter_v${versionCode}_PlayStore_${versionName}.apk"
} else {
dirName += "dev"
def branchName = getWorkingBranch()
if (branchName.equals("develop")) {
apkName = "Lookcounter_v${versionCode}_DEV_${build}.apk"
} else {
apkName = "Lookcounter_v${versionCode}_DEV_${branchName}_${build}.apk"
}
}
copy {
def source = variant.outputs.get(0).getOutputFile()
from source
into dirName
include source.name
rename source.name, apkName
println "Output APK copied to $dirName/$apkName"
}
}
}
}
}
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// compile "com.dev.sacot41:scviewpager:0.0.4"
compile project(':androidSVG')
compile files('../libraries/PriorityDeque-1.0.jar')
compile project(':cropper')
testCompile 'junit:junit:4.12'
// Possibly Keep
compile('com.doomonafireball.betterpickers:library:1.6.0') {
exclude group: 'com.android.support', module: 'support-v4'
}
// KEEP
compile('com.nostra13.universalimageloader:universal-image-loader:1.9.5') {
exclude group: 'com.android.support', module: 'support-v7'
}
compile('com.twitter.sdk.android:tweet-composer:0.7.3#aar') {
transitive = true;
}
compile('com.crashlytics.sdk.android:answers:1.3.6#aar') {
transitive = true;
}
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:support-v4:23.2.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.jakewharton:butterknife:5.1.2'
compile 'org.apache.commons:commons-lang3:3.1'
compile 'com.github.clans:fab:1.6.2'
compile 'com.facebook.android:facebook-android-sdk:3.21.1'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.google.code.ksoap2-android:ksoap2-android:3.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:support-vector-drawable:23.2.0'
compile 'com.android.support:animated-vector-drawable:23.2.0'
}
You can't use SVGs directly as a Resource. The Android resource loading system doesn't know what an SVG is. What you need to use is something like:
SVG svg = SVG.getFromResource(R.raw.icon_other_blue);
socialTypeImage.setImageDrawable(new PictureDrawable(svg.toPictureDrawable()));
Or you can use the SVGImageView widget class that is provided. Documentation here.

Categories

Resources