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.
Related
I've recently updated gradle to 3.4.0 and when uploading the build to the store I received a warning message letting me know that users will not be able to see the new build.
The only difference between the old apk and the new one is that the new one only has these native platforms
Native platforms
arm64-v8a, armeabi-v7a, x86, x86_64
while the old one also has the mips abi.
I went to the store after a couple of hours after uploading he build and I can't see the new build.
Any ideas ?! Why does that influence the apk from being able to be seen from the store, if they're deprecated... ?!
Or could the problem come from another place?
EDIT
Could the problem arise from this instead by any chance?
// Butterknife requires Java 8.
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
EDIT 2
Here's my entire app level build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.29.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
lintOptions { checkReleaseBuilds false }
compileSdkVersion 28
buildToolsVersion '28.0.3'
signingConfigs {
releaseSign {
storeFile file("$rootProject.projectDir/keystore_release.jks")
storePassword 'xxxxx'
keyAlias 'xxxx'
keyPassword 'xxxx'
}
}
// Butterknife requires Java 8.
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.xxxx.driver"
minSdkVersion 19
targetSdkVersion 28
versionCode 27
versionName "1.0.27"
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
multiDexEnabled true
splits {
abi {
reset()
include "x86", "armeabi-v7a", "armeabi-v8a", "x86_64", "mips", "mips64"
universalApk true
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.releaseSign
}
}
flavorDimensions "default"
productFlavors {
beta {
applicationId "com.xxxx.driver.beta"
dimension "default"
resValue "string", "app_name", "Driver Beta"
resValue "string", "privacy_policy_url", "https://www.xxxxxx"
buildConfigField "String", "BASE_URL", '"https://xxxxxxx"'
buildConfigField "Boolean", "IS_BETA", "true"
buildConfigField "String", "TENANT", '"xxxxx"'
}
production {
applicationId "com.xxxxx.driver"
dimension "default"
resValue "string", "app_name", "Driver"
resValue "string", "privacy_policy_url", "https://www.xxxxx"
buildConfigField "String", "BASE_URL", '"https://xxxxx"'
buildConfigField "Boolean", "IS_BETA", "false"
buildConfigField "String", "TENANT", '"xxxx"'
}
}
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/notice'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license'
exclude 'META-INF/license.txt'
}
}
configurations.all {
// resolutionStrategy {
// eachDependency { DependencyResolveDetails details ->
// if (details.requested.group == 'com.android.support' && details.requested.name != 'multidex') {
// details.useVersion "28.0.0"
// }
// }
// }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha06'
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'me.grantland:autofittextview:0.2.1'
implementation 'com.android.volley:volley:1.1.1'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.github.ybq:Android-SpinKit:1.2.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.0'
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
def work_version = "2.0.1"
implementation "androidx.work:work-runtime:$work_version"
// Optional - RxJava2 support
implementation "androidx.work:work-rxjava2:$work_version"
def futures_version = "1.0.0-beta01"
implementation "androidx.concurrent:concurrent-futures:$futures_version"
implementation 'com.github.delight-im:Android-AdvancedWebView:v3.0.0'
}
apply plugin: 'com.google.gms.google-services'
And my top level build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
So I figured it out myself. The solution was that, their system is buggy. There is nothing wrong with my app. I sent them an email and they answered after a week+. After that, everything is working fine. A number of days after posting this question, a colleague also had this issue with another app, so if you do happen to come across this issue send them an email and ask.
I have an app already published on the store, after upgrading to Android Studio 3 (now 3.1) and the forced update of gradle I am unable to import my external projects as modules.
I have tried removing all my modules and adding them one by one, deleting the cache, changing gradle version, and compileSdkVersion but it doesn't work.
When I try to sync gradle I receive some messages like this:
Unable to resolve dependency for ':app#produzioneDebug/compileClasspath': Failed to transform file 'ShareLib-release.aar' to match attributes {artifactType=android-exploded-aar} using transform ExtractAarTransform
This is in my settings.gradle to make external project available:
include ':app'
include ':ShareLib'
project(':ShareLib').projectDir = new File('..//ShareLib//')
This is my build.gradle
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
jcenter()
mavenCentral()
mavenLocal()
maven {
url 'https://repo.spring.io/libs-milestone'
}
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
def AAVersion = '4.4.0'
android {
compileSdkVersion 26
buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 15
targetSdkVersion 26
versionCode 3
versionName "1.0.0.0"
applicationId "com.xxx.app"
// Enabling multidex support.
multiDexEnabled true
javaCompileOptions {
annotationProcessorOptions {
arguments = ["resourcePackageName": android.defaultConfig.applicationId]
}
}
}
signingConfigs {
releaseSigning {
///
}
}
buildTypes {
debug {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
zipAlignEnabled true
}
release {
// proguard
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
shrinkResources false
zipAlignEnabled true
signingConfig signingConfigs.releaseSigning
}
}
flavorDimensions "tier"
productFlavors {
dev {
buildConfigField "String", "SERVICE_URL_BASE", "\"dev.xxx.com/xxx-rest\""
applicationId "development.xxx.app"
}
coll {
buildConfigField "String", "SERVICE_URL_BASE", "\"dev.xxx.com/xxx-rest\""
applicationId "test.xxx.app"
}
prod {
buildConfigField "String", "SERVICE_URL_BASE", "\"www.xxx.com/xxx-rest\""
applicationId "com.xxx.app"
}
}
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'
}
dexOptions {
javaMaxHeapSize "4g"
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation project(path: ':shareLib', configuration: 'default')
// implementation project(path: ':shareLib', configuration: 'default') {
// exclude module: 'jsr305'
// }
// compile fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation 'com.squareup:otto:1.3.8'
implementation 'org.springframework.android:spring-android-rest-template:2.0.0.M3'
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
implementation "org.androidannotations:androidannotations-api:$AAVersion"
annotationProcessor "org.androidannotations:rest-spring:$AAVersion"
implementation "org.androidannotations:rest-spring-api:$AAVersion"
annotationProcessor "org.androidannotations:otto:$AAVersion"
implementation "org.androidannotations:otto:$AAVersion"
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
// support AA on Android < 5
// compile 'com.android.support:multidex:1.0.1'
implementation 'com.github.markomilos:paginate:0.5.1'
// mpandroid
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.0-beta1'
// crashlytics fabric
implementation('com.crashlytics.sdk.android:crashlytics:2.6.1#aar') {
transitive = true
}
// recaptcha
implementation ('android.lib.recaptcha:reCAPTCHA:2.0.0') {
exclude group: 'com.android.support'
}
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.9.0'
}
I have solved opening modules project one by one and doing this for each one:
Project Structure -> Project -> Gradle Version = 4.7
Settings -> Build, Execution, Deployment -> Compiler -> Uncheck "Configure on demand"
Rebuild project once you can see your .aar file into build/outputs/aar
Then repeat these steps for main project module
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
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
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.