Android Wear ClassNotFoundException after gradle update - android

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
}

Related

Unable to make executable signed-release build dexgaurd

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

My App's RecycleViews don't have a scrollbar,but it works on a new project

I found this code does't work in my Project.
android:scrollbars="vertical"
But if i set this to a new DEMO,it works.
I think it's about App styles or something in build.gradle,but i try many methods and it's just didn't work(like copy the Application styls from my project to the new project and apply it,it still works),any one else has this problem?
this is my build.gradle code:
android {
compileSdkVersion COMPILE_SDK_VERSION as int
buildToolsVersion BUILD_TOOLS_VERSION
defaultConfig {
applicationId "com.haixue.app.android.HaixueAcademy.h4"
minSdkVersion MIN_SDK_VERSION as int
targetSdkVersion TARGET_SDK_VERSION as int
versionCode 3210
versionName "3.2.1beta"
multiDexEnabled true
resConfigs "zh"
resValue("string", "growingio_project_id", "8701f2e2e096a888")
resValue("string", "growingio_url_scheme", "growing.42190e827fb47099")
ndk {
abiFilters "armeabi", "armeabi-v7a"
}
useLibrary 'org.apache.http.legacy'
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/MANIFEST.MF'
exclude 'META-INF/maven/com.squareup.okio/okio/pom.properties'
exclude 'META-INF/maven/com.squareup.okio/okio/pom.xml'
}
lintOptions {
abortOnError false
xmlReport false
htmlReport true
htmlOutput file("$project.buildDir/reports/lint/lint-result.html")
xmlOutput file("$project.buildDir/reports/lint/lint-result.xml")
}
signingConfigs {
release {
storeFile file("../docs/haixue.keystore")
storePassword "123456"
keyAlias "highso"
keyPassword "123456"
}
debug {
storeFile file("../docs/haixue.keystore")
storePassword "123456"
keyAlias "highso"
keyPassword "123456"
}
}
walle {
apkOutputFolder = new File("${project.buildDir}/outputs/channels");
apkFileNameFormat = '${appName}-${channel}-${buildType}-v${versionName}.apk';
channelFile = new File("${project.getProjectDir()}/channel")
}
buildTypes {
debug {
debuggable true
minifyEnabled false
shrinkResources false
testCoverageEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
shrinkResources true
zipAlignEnabled true
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = outputFile.name.replace(".apk", "-${defaultConfig.versionName}.apk")
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
//JNI
sourceSets {
main {
jni.srcDirs = []
jniLibs.srcDir(['libs'])
}
}
dexOptions {
javaMaxHeapSize "4g"
}
repositories {
flatDir {
dirs 'libs'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':RtmpResourceLib')
compile project(':imagepicker')
compile project(':viewPagerlibrary')
compile project(':SlidingMenu')
compile project(':treeviewlist')
compile project(':NodeView')
compile files('libs/jcore-android-1.1.6.jar')
compile files('libs/jpush-android-3.0.8.jar')
compile files('libs/TalkFunSDK.jar')
compile files('libs/alipaySingle-20170510.jar')
compile(name: 'alicloud-android-feedback-3.1.1', ext: 'aar')
compile files('libs/alicloud-android-utils-1.0.3.jar')
compile files('libs/utdid4all-1.1.5.3_proguard.jar')
compile files('libs/alicloud-android-monitor-2.5.1.1_for_bc_proguard.jar')
//noinspection GradleCompatible
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:recyclerview-v7:26.0.2'
compile 'com.android.support:design:26.0.2'
compile 'com.android.support:support-annotations:26.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.code.gson:gson:2.8.1'
//compile 'com.tencent.bugly:crashreport:2.6.5' crashreport_upgrade
compile 'com.tencent.bugly:crashreport_upgrade:latest.release'
compile 'com.tencent.bugly:nativecrashreport:latest.release'
compile 'com.growingio.android:vds-android-agent:1.0.3#aar'
compile 'com.umeng.analytics:analytics:latest.integration'
compile 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:1.0.2'
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
compile 'com.github.Aspsine:SwipeToLoadLayout:1.0.4'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.0'
compile 'com.lzy.net:okgo:2.1.4'
compile 'com.github.hackware1993:MagicIndicator:1.5.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.zhy:autolayout:1.4.5'
compile 'io.reactivex.rxjava2:rxjava:2.1.3'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.j256.ormlite:ormlite-android:5.0'
compile 'com.j256.ormlite:ormlite-core:5.0'
compile 'com.meituan.android.walle:library:1.1.3'
compile 'com.zhy:flowlayout-lib:1.0.3'
compile 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.3'
compile 'com.google.android.exoplayer:exoplayer-core:r2.5.2'
compile 'com.google.android.exoplayer:exoplayer-hls:r2.5.2'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.3'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.3'
compile 'com.kyleduo.switchbutton:library:1.4.6'
}
I figure it out
#android:color/transparent
SomeOthers set this in our App's Style ,this code make the ScrollBar transparent.

Error:Execution failed for task ':app:transformClassesWithDexForPlayDebug'

**Error:Execution failed for task ':app:transformClassesWithDexForPlayDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --num-threads=4 --multi-dex --main-dex-list D:\Android_Project\prayer-times-android-master\app\build\intermediates\multi-dex\play\debug\maindexlist.txt --output D:\Android_Project\prayer-times-android-master\app\build\intermediates\transforms\dex\play\debug\folders\1000\1f\main D:\Android_Project\prayer-times-android-master\app\build\intermediates\transforms\jarMerging\play\debug\jars\1\1f\combined.jar}**
build.gradle(Module App)
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' } //excludeInFDroid
}
dependencies {
//noinspection GradleDynamicVersion
classpath 'io.fabric.tools:gradle:+' //excludeInFDroid
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric' //excludeInFDroid
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude '.readme'
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
signingConfigs {
debugKey {
storeFile file('D:/TU-Cloud/Dokumente/Sonstiges/debug.keystore')
keyAlias 'androiddebugkey'
keyPassword 'android'
storePassword 'android'
}
}
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com.metinkale.prayer"
minSdkVersion 15
targetSdkVersion 25
signingConfig signingConfigs.debugKey
versionCode 189
versionName '3.6.5'
multiDexEnabled true
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
dexOptions {
javaMaxHeapSize "2g"
preDexLibraries = true
}
buildTypes {
debug {
debuggable true
signingConfig signingConfigs.debugKey
minifyEnabled false
zipAlignEnabled false
}
release {
debuggable false
minifyEnabled true
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
productFlavors {
fdroid {
versionName = android.defaultConfig.versionName + " F-Droid"
}
play {
versionName = android.defaultConfig.versionName + " Play Store"
repositories {
maven { url 'https://maven.fabric.io/public' } //excludeInFDroid
}
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
playCompile('com.crashlytics.sdk.android:crashlytics:2.6.6#aar') {//excludeInFDroid
transitive = true;//excludeInFDroid
} //excludeInFDroid
fdroidCompile('com.mapbox.mapboxsdk:mapbox-android-sdk:4.1.1#aar') {
transitive = true
}
compile('com.mikepenz:aboutlibraries:5.8.5#aar') {
transitive = true
}
compile 'com.vanniktech:vntnumberpickerpreference:1.0.0'
compile 'com.android.support:percent:25.2.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'joda-time:joda-time:2.9.6:no-tzdb'
compile 'com.koushikdutta.ion:ion:2.1.9'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'net.steamcrafted:materialiconlib:1.1.1'
compile 'com.android.support:customtabs:25.2.0'
compile 'com.evernote:android-job:1.1.3'
compile 'com.github.anrwatchdog:anrwatchdog:1.3.0'
playCompile 'com.google.android.gms:play-services-maps:10.2.1' //excludeInFDroid
playCompile 'com.google.android.gms:play-services-gcm:10.2.1' //excludeInFDroid
playCompile 'com.google.android.gms:play-services-location:10.2.1' //excludeInFDroid
debugCompile '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 'com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
}
}

Compile time errors with dagger

Very often while compiling I get the following error:
Error:(5, 18) error: cannot find symbol class DaggerDataComponent
Error:(14, 21) error: cannot find symbol class DaggerNetComponent
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
It is enough to start building again with no changes to make the building succeeding.
I have the Instant Run feature disabled.
I'm using Java8 with retrolambda and dagger2 2.8.
This is my build.gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.3.1'
}
}
plugins {
id "me.tatarka.retrolambda" version "3.3.1"
}
// Required because retrolambda is on maven central
repositories {
mavenCentral()
}
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 25
buildToolsVersion "24.0.2"
compileOptions.incremental = false
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "org.app"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
jackOptions {
enabled false
}
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
}
compileOptions {
incremental true
}
/**
* Signing keys config.
*/
signingConfigs {
debug {
storeFile file("ddebug.keystore")
keyAlias "ddebug"
storePassword "07477800086d!"
keyPassword "07477800086d!"
}
release {
storeFile file("drelease.keystore")
keyAlias "drelease"
storePassword "07477800086d!"
keyPassword "07477800086d!"
}
}
buildTypes {
release {
debuggable false
minifyEnabled true
zipAlignEnabled true
renderscriptDebuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
debuggable true
signingConfig signingConfigs.debug
minifyEnabled false
versionNameSuffix "_dev"
}
}
}
dependencies {
apt 'com.google.dagger:dagger-compiler:2.7'
compile 'com.google.dagger:dagger:2.7'
provided 'javax.annotation:jsr250-api:1.0'
apt 'com.gabrielittner.auto.value:auto-value-with:1.0.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
def supportVersion = '25.1.0'
compile "com.android.support:appcompat-v7:$supportVersion"
compile "com.android.support:design:$supportVersion"
compile "com.android.support:cardview-v7:$supportVersion"
compile "com.android.support:recyclerview-v7:$supportVersion"
compile "com.android.support:support-annotations:$supportVersion"
compile "com.android.support:gridlayout-v7:$supportVersion"
compile "com.android.support:support-annotations:$supportVersion"
compile 'io.reactivex:rxandroid:0.24.0'
def retrofit2 = '2.1.0'
def okhttp3 = '3.4.1'
compile "com.squareup.retrofit2:retrofit:$retrofit2"
compile "com.squareup.retrofit2:adapter-rxjava:$retrofit2"
compile "com.squareup.retrofit2:converter-gson:$retrofit2"
compile "com.squareup.okhttp3:okhttp:$okhttp3"
compile "com.squareup.okhttp3:okhttp-urlconnection:$okhttp3"
compile "com.squareup.okhttp3:logging-interceptor:$okhttp3"
def butter_knife = '8.4.0'
apt "com.jakewharton:butterknife-compiler:$butter_knife"
compile "com.jakewharton:butterknife:$butter_knife"
def leak_canary = '1.4-beta2'
debugCompile "com.squareup.leakcanary:leakcanary-android:$leak_canary"
releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leak_canary"
testCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leak_canary"
compile 'com.github.clans:fab:1.6.4'
compile 'io.reactivex:rxjava:1.2.0'
compile 'io.reactivex:rxandroid:1.2.0'
compile 'com.jakewharton.rxbinding:rxbinding-support-v4:0.4.0'
provided 'com.google.auto.value:auto-value:1.2'
apt 'com.google.auto.value:auto-value:1.2'
compile 'com.ryanharter.auto.value:auto-value-parcel-adapter:0.2.5'
apt 'com.ryanharter.auto.value:auto-value-parcel:0.2.5'
apt 'com.ryanharter.auto.value:auto-value-gson:0.3.2-rc1'
compile 'com.github.bumptech.glide:glide:3.5.2'
compile 'com.jakewharton.timber:timber:4.3.1'
compile 'com.google.firebase:firebase-crash:9.4.0'
compile 'com.google.firebase:firebase-auth:9.4.0'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'junit:junit:4.12'
//other dependencies for testing
def hamcrestVersion = '1.3'
testCompile "org.hamcrest:hamcrest-core:$hamcrestVersion"
testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
testCompile "org.hamcrest:hamcrest-integration:$hamcrestVersion"
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
}
apply plugin: 'com.google.gms.google-services'
android.packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}

app:shrinkReleaseMultiDexComponents Error

When i create an Signed APK it gives an error:
Error:Execution failed for task :app:shrinkReleaseMultiDexComponents.
java.io.IOException: The output jar [G:\D drive\CommunityMatrimony\app\build\intermediates\multi-dex\release\componentClasses.jar] must be specified after an input jar, or it will be empty.
This is my Gradle File:
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'xxxx'
keyPassword 'xxxx'
storeFile file('F:/CMJAR.jks')
storePassword 'xxxx'
}
}
compileSdkVersion 23
buildToolsVersion '23.0.1'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.xxxx.yyyy"
minSdkVersion 11
targetSdkVersion 22
versionCode 42
versionName "2.8.2"
multiDexEnabled true
signingConfig signingConfigs.config
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
productFlavors {
}
compileOptions.encoding = 'ISO-8859-1'
dexOptions {
javaMaxHeapSize "4g"
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/DEPENDENCIES'
}
}
repositories {
mavenCentral()
maven {
url "https://s3-ap-southeast-1.amazonaws.com/godel-release/godel/"
}
flatDir {
dirs 'libs'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
dependencies {
provided fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile files('libs/AF-Android-SDK-v2.3.1.18.jar')
compile(name: 'gamooga-livechat-client-release', ext: 'aar')
compile 'com.koushikdutta.ion:ion:2.1.6'
compile 'org.apache.httpcomponents:httpmime:4.2.1'
compile 'com.koushikdutta.async:androidasync:2.1.6'
compile 'in.juspay:godel:0.6.6'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'org.codehaus.jackson:jackson-core-asl:1.9.13'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.android.support:multidex:1.0.1'
}

Categories

Resources