I try to start migrating a Java based multidexed project to Kotlin but I get ClassNotFoundException whenever the app tries to reference a Kotlin class. The weird thing is that the same code sometimes works sometimes it doesn't. There are computers which produce working apk and others don't. Sometimes a rebuild is enough to solve the problem.
I've tried to google it but I've only found this thread, but there is no resolution. Does this thing work properly for everyone else or aren't there any multidexed Kotlin project yet?
I've tried with AS 2.3.3 and AS 3.0.0-beta6, 2.3.3 android plugun, kotoin version 1.1.50, without proguard.
buildscript {
ext.kotlin_version = '1.1.50'
ext.android_plugin_version = '2.3.3'
ext.support_lib_version = '25.3.1'
ext.play_services_version = '11.0.4'
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath "com.android.tools.build:gradle:$android_plugin_version"
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.google.firebase:firebase-plugins:1.1.1'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
apply plugin: "com.android.application"
apply plugin: "me.tatarka.retrolambda"
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: "com.google.firebase.firebase-perf"
repositories {
mavenCentral()
jcenter()
maven {
url "https://jitpack.io"
}
}
android {
signingConfigs {
debug {
...
}
}
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.my.app"
signingConfig signingConfigs.debug
minSdkVersion 14
targetSdkVersion 25
versionCode 13
versionName "2.0.1.b8face5"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
testInstrumentationRunner "com.my.app.TestRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
//this is because instabug uses rxjava 1 and now we have both 1 and 2 on the classpath
packagingOptions {
exclude "META-INF/rxjava.properties"
}
buildTypes {
debug {
applicationIdSuffix ".debug"
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
}
}
}
dependencies {
compile fileTree(include: "*.jar", dir: "libs")
// Force usage of support annotations in the test app, since it is internally used by the runner module.
androidTestCompile("com.android.support.test.espresso:espresso-core:2.2.1") {
exclude module: "support-annotations"
}
androidTestCompile("com.android.support.test.espresso:espresso-contrib:2.2.1") {
// Necessary to avoid version conflicts
exclude group: "com.android.support", module: "appcompat"
exclude group: "com.android.support", module: "support-v4"
exclude group: "com.android.support", module: "support-annotations"
exclude module: "recyclerview-v7"
}
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile "com.android.support:appcompat-v7:$support_lib_version"
compile "com.android.support:recyclerview-v7:$support_lib_version"
compile "com.android.support:design:$support_lib_version"
compile "com.android.support:cardview-v7:$support_lib_version"
compile "com.google.android.gms:play-services-auth:$play_services_version"
compile "com.google.android.gms:play-services-identity:$play_services_version"
compile "com.google.android.gms:play-services-location:$play_services_version"
compile "com.google.android.gms:play-services-maps:$play_services_version"
compile "com.google.firebase:firebase-core:$play_services_version"
compile "com.google.firebase:firebase-crash:$play_services_version"
compile "com.google.firebase:firebase-perf:$play_services_version"
compile "com.google.code.gson:gson:2.8.1"
compile "com.google.maps.android:android-maps-utils:0.4"
compile "com.squareup.retrofit2:retrofit:2.3.0"
compile "com.squareup.retrofit2:converter-gson:2.3.0"
compile "com.squareup.retrofit2:adapter-rxjava2:2.3.0"
compile "io.reactivex.rxjava2:rxandroid:2.0.1"
compile "io.reactivex.rxjava2:rxjava:2.1.3"
compile "com.squareup.okhttp3:okhttp-urlconnection:3.8.1"
compile "com.facebook.stetho:stetho:1.5.0"
compile "com.facebook.stetho:stetho-okhttp3:1.5.0"
compile "com.squareup.picasso:picasso:2.5.2"
compile "com.jakewharton:butterknife:8.2.1"
compile "com.annimon:stream:1.1.8"
compile "com.github.lawloretienne:quickreturn:0.0.1"
compile "com.github.chrisbanes:PhotoView:1.2.6"
compile "fr.baloomba:viewpagerindicator:2.4.2"
compile "com.github.bluejamesbond:textjustify-android:2.1.6"
compile "com.turingtechnologies.materialscrollbar:lib:10.1.4"
compile "com.github.PhilJay:MPAndroidChart:v3.0.1"
compile "com.android.support:multidex:1.0.1"
compile "com.bugsnag:bugsnag-android:3.9.0"
//TODO check periodically whether they upgraded to rxjava 2
compile "com.instabug.library:instabug:4.2.11"
testCompile "junit:junit:4.12"
androidTestCompile "com.android.support:support-annotations:$support_lib_version"
androidTestCompile "com.android.support.test:runner:0.5"
androidTestCompile "com.android.support.test:rules:0.5"
annotationProcessor "com.jakewharton:butterknife-compiler:8.2.1"
compile "com.google.dagger:dagger:2.5"
annotationProcessor "com.google.dagger:dagger-compiler:2.5"
provided "javax.annotation:jsr250-api:1.0"
}
apply plugin: "com.google.gms.google-services"
Finally I was able to solve the issue! The exception was caused by a RetroLambda bug and thankfully disappeared after I updated to 3.7.0. The build was nondeterministic because it seems gradle clean doesn't delete everything. After I manually deleted the build folder both in the app and root module, the results became deterministic.
If you are using Java 8 then you should also use Kotlin jre8.
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
Related
I'm trying to run old project that runs for a lot of time.
Suddenly I'm unable to run it.
This is the build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.1.3"
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
flatDir {
dirs 'libs'
}
// For MobFox
maven {
url "https://jitpack.io"
}
// For AppBrain SDK
maven {
url 'http://swisscodemonkeys.github.io/appbrain-sdk/maven'
}
}
}
This is the gradle-wrapper.properties file:
#Sun Nov 12 11:49:59 IST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
org.gradle.jvmargs=-Xmx4608M
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
And i get this error:
Gradle sync failed: Could not find gradle.jar (com.android.tools.build:gradle:3.0.0).
Searched in the following locations:https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar
When I change the order between the google() and jcenter(), this error disappears but i get this error now:
error: cannot access zzbfm
class file for com.google.android.gms.internal.zzbfm not found
Any idea of how I can fix this issue? I prefer to not upgrade the Gradle version since this is a complicated project and I need to upload an update really soon without making a lot of changes.
EDIT
This is the app build.gradle file:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
multiDexEnabled true
minSdkVersion 16
targetSdkVersion 26
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
renderscriptTargetApi 22
renderscriptSupportModeEnabled true
}
buildTypes {
debug {
debuggable true
buildConfigField "boolean", "CRASH_LOGGING", "true"
applicationIdSuffix ".dev"
}
release {
debuggable false
buildConfigField "boolean", "CRASH_LOGGING", "true"
minifyEnabled true
proguardFiles 'proguard-project.txt'
}
}
flavorDimensions "regular"
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
implementation "com.android.support:support-compat:26.1.0"
compile 'com.google.android.gms:play-services-auth:11.8.0'
compile 'com.google.android.gms:play-services-ads:11.8.0'
compile('com.thoughtworks.xstream:xstream:1.4.7') {
exclude group: 'xmlpull', module: 'xmlpull'
}
compile 'org.apache.commons:commons-lang3:3.6'
compile 'joda-time:joda-time:2.9.9'
compile('org.simpleframework:simple-xml:2.7.1') {
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'xpp3'
}
compile group: 'com.google.code.gson', name: 'gson', version: '2.7'
// UI & VIEWS
compile 'com.tuyenmonkey:mkloader:1.4.0'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'com.github.mmin18:realtimeblurview:1.1.0'
compile 'com.github.PhilJay:ValueBar:v1.0.2'
// IMAGE HANDLING
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
// NETWORK HANDLING
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.okhttp3:okhttp:3.9.0'
//RETORFIT
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile('com.squareup.retrofit2:converter-simplexml:2.3.0') {
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'xpp3'
}
compile 'com.squareup.retrofit2:converter-scalars:2.3.0'
// FABRIC
compile('com.crashlytics.sdk.android:crashlytics:2.7.1#aar') {
transitive = true;
}
// ADS
compile 'com.flurry.android:analytics:8.2.0#aar'
compile 'com.appbrain:appbrain-sdk:14.60#aar'
compile(name: 'android-ad-sdk', ext: 'aar')
compile(name: 'SOMAAndroid-9.1.5-release', ext: 'aar')
compile 'com.applovin:applovin-sdk:+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
samsungDebugCompile files('libs/sdk-v1.0.0.jar')
samsungDebugCompile files('libs/motion-v2.2.2.jar')
samsungReleaseCompile files('libs/sdk-v1.0.0.jar')
samsungReleaseCompile files('libs/motion-v2.2.2.jar')
//debug DB
debugCompile 'com.amitshekhar.android:debug-db:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
Just go the file menu and click on invalidate cache and restart the android studio.
Then from build menu do clean, rebuild and make project.
This error appears after I updated to Android Studio 3.0. I tried many ways in many similar questions, but nothing works.
Here is the error:
I realized that when I remove the library 'com.google.android.gms:play-services-maps:11.4.2' my project build successful. But I need this library in my project, anyone knows how to deal with this problem?
My complete build.gradle.
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "vn.com.ttsoft.dhd"
minSdkVersion 21
targetSdkVersion 25
versionCode 14
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
useLibrary 'org.apache.http.legacy'
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
// Disable fabric build ID generation for debug builds
ext.enableCrashlytics = false
}
}
productFlavors {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/android-async-http-1.4.4.jar')
compile files('libs/google-play-services.jar')
compile files('libs/gson-2.3.1.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
compile 'com.github.pavlospt:roundedletterview:1.2'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:design:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
compile 'com.google.android.gms:play-services-maps:11.4.2'
compile 'me.tatarka.support:jobscheduler:0.1.1'
compile 'com.evernote:android-job:1.1.8'
testCompile 'junit:junit:4.12'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/mail.jar')
}
I am putting the gradle file you can use it may help you
apply plugin: 'com.android.application'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "vn.com.ttsoft.dhd"
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
// Disable fabric build ID generation for debug builds
ext.enableCrashlytics = false
}
}
}
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.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile files('libs/android-async-http-1.4.4.jar')
compile files('libs/google-play-services.jar')
compile files('libs/gson-2.3.1.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.7.1#aar') {
transitive = true;
}
compile 'com.github.pavlospt:roundedletterview:1.2'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:support-v4:25.3.0'
compile 'me.tatarka.support:jobscheduler:0.1.1'
compile 'com.evernote:android-job:1.1.8'
testCompile 'junit:junit:4.12'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/mail.jar')
}
apply plugin: 'io.fabric'
and another project gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'io.fabric.tools:gradle:1.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
I was also facing the same issue and I think something is wrong with google play services dependencies so I got it resolved by adding all below google play services dependencies :
compile 'com.google.android.gms:play-services-base:11.4.2'
compile 'com.google.android.gms:play-services-auth:11.4.2'
compile 'com.google.firebase:firebase-core:11.4.2'
compile 'com.google.firebase:firebase-messaging:11.4.2'
compile 'com.google.android.gms:play-services-gcm:11.4.2'
compile 'com.google.android.gms:play-services-location:11.4.2'
compile 'com.google.android.gms:play-services-maps:11.4.2'
compile 'com.google.android.gms:play-services-places:11.4.2'
I had a similar problem with the 'Multiple Dex' build error after upgrading to AS 3.0 / Gradle 3.0.0.
I found that the invalidate caches and restart, clean project, and minifyEnabled "solutions" were all red herrings.
I struggled with this for a few hours then found out what was causing my problem.
I was compiling Picasso, GSON and SQLiteAssetHelper using the statements
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.squareup.picasso:picasso:2.5.2'
...but I also had the sqliteassethelper, GSON and Picasso .jar files being compiled from my \libs folder.
compile fileTree(include: ['*.jar'], dir: 'libs')
Hence the duplicates.
Yes - pretty obvious but sometimes you can't see the wood for the trees!
I hope this helps someone.
(Final Note: compile command is deprecated in Gradle 3.0.0, therefore you might wish to change the above commands from compile to implementation)
What version of Play Services do you load from file? I guess that's an issue, you try to load whole play services and partial play-services-maps together. Also that explains the fact that, when you remove maps, everything works fine.
take a look on this link for selective compiling play services APIs, this will also help to reduce method count
https://developers.google.com/android/guides/setup
To somebody who is using android-async-http and had tried enable DEX, invalidate cache, delete .gradle files and check duplicate import/version:
I have some conflict in org.apache and android-async-http packages,
after I change i.e. org.apache.http.Header
to cz.msebera.android.httpclient.Header, my problem solved.
{
useLibrary 'org.apache.http.legacy' // avoid this
}
dependencies {
compile files('libs/android-async-http-1.4.4.jar') // only keep this one
}
I'm just trying to use the Firebase Cloud Messaging but i'm getting a error. This is my first time doing this, so i think could be a version of the location services of something. I already put a few libraries, but i'm not sure whats is the problem.
The Firebase is which is making some problems.
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.2.6.
This is my Gradle (App).
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.xxx.xxx.xxx"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
allprojects {
repositories {
// Add this line
maven { url "https://jitpack.io" }
}
}
compile('com.wdullaer:materialdatetimepicker:3.2.2') {
exclude group: 'com.android.support'
}
compile 'com.google.firebase:firebase-core:10.2.6'
compile 'com.github.Mariovc:ImagePicker:1.2.0'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.+'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.google.android.gms:play-services-location:11.0.4'
compile 'com.android.support:support-v4:26.0.0-alpha1'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.android.support:cardview-v7:26.0.+'
compile 'com.android.support:recyclerview-v7:26.0.+'
compile 'de.hdodenhof:circleimageview:2.1.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
And this is the other Gradle.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.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
}
Please help me, i'm in a rush
You are using different version of the same library using:
compile 'com.google.firebase:firebase-core:10.2.6'
compile 'com.google.android.gms:play-services-location:11.0.4'
You can use:
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
or you can switch to the latest stable version:
compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.android.gms:play-services-location:11.2.0'
This release requires to add the google maven repo.
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
More info about the releases of google play services here and firebase here.
Also you should use the stable version of:
compile 'com.android.support:support-v4:26.0.0'
Try to change the firebase version to the following:
compile 'com.google.android.gms:play-services:11.0.2'
compile 'com.google.firebase:firebase-core:11.0.2'
And add play-services
This error also occurs if one does not add apply plugin: 'com.google.gms.google-services' to the bottom of app/build.gradle. I happened to overlook it and added it below apply plugin: 'com.android.application'.
Android studio build issue Google sign in and Firebase latest version 10.2.4
google sign in was working fine until I have put firebase jar in gradle and its throwing "Error:(149, 28) The type com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable cannot be found in source files, imported jack libs or the classpath"
below is app level build
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "viksit.com.viksit.pro.viksitpro"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2') {
exclude group: 'com.android.support', module: 'support-annotations'
}
android {
useLibrary 'org.apache.http.legacy'
}
compile project(':linkedin-sdk')
compile(group: 'org.simpleframework', name: 'simple-xml', version: '2.7.1') {
exclude group: 'xpp3', module: 'xpp3'
}
compile('com.udojava:EvalEx:1.0') {
exclude group: 'junit', module: 'junit'
}
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.android.support:appcompat-v7:25.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.facebook.android:facebook-android-sdk:4.18.0'
compile 'com.afollestad.material-dialogs:commons:0.9.4.2'
compile 'com.google.firebase:firebase-database:10.2.4'
compile 'com.google.firebase:firebase-core:10.2.4'
compile 'com.google.firebase:firebase-auth:10.2.4'
compile 'com.google.android.gms:play-services-auth:10.2.4'
compile 'com.google.gms:google-services:3.0.0'
compile 'com.android.support:support-v4:25.0.2'
compile 'com.felipecsl:gifimageview:2.1.0'
compile 'me.itangqi.waveloadingview:library:0.3.5'
compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
compile 'com.github.siyamed:android-shape-imageview:0.9.+#aar'
compile 'com.android.support:design:25.3.0'
compile 'com.github.vipulasri:timelineview:1.0.5'
compile 'com.jaredrummler:material-spinner:1.1.0'
compile 'com.bignerdranch.android:expandablerecyclerview:3.0.0-RC1'
compile 'com.truizlop.sectionedrecyclerview:library:1.2.0'
compile 'com.github.castorflex.verticalviewpager:library:19.0.1'
compile 'link.fls:swipestack:0.3.0'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.3'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.+'
testCompile 'junit:junit:4.12'
}
below is project level build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Looks like you skipped this step
apply plugin: 'com.google.gms.google-services' line be at the bottom of your app/build.gradle file
https://developers.google.com/android/guides/google-services-plugin
Sidenote: You have Glide and Picasso, two-way gif drawable libraries, and two shaped imageview libraries. Each pair do the same thing. Clean out your dependencies to reduce your app size and chances of errors
I had a similiar problem with firebase yesterday and this worked for me:
Just add this to gradle file and rebuild it:
android {
....
dexOptions {
// Prevent OutOfMemory with MultiDex during the build phase
javaMaxHeapSize "4g"
}
}
Twice already I've tried to get android-apt to work, because it's required by the 3rd-party libraries I wanted to use (AndroidAnnotations and PermissionsDispatcher), and both times I bashed my head against the wall until I got tired of hearing the squishing sound.
The problem? Android Studio simply fails to find or fetch the dependencies:
Error:Could not find com.neenbedankt.gradle:plugins:android-apt.
Searched in the following locations:
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/neenbedankt/gradle/plugins/android-apt/plugins-android-apt.pom
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/neenbedankt/gradle/plugins/android-apt/plugins-android-apt-1.8.jar
https://jcenter.bintray.com/com/neenbedankt/gradle/plugins/android-apt/plugins-android-apt.pom
https://jcenter.bintray.com/com/neenbedankt/gradle/plugins/android-apt/plugins-android-apt-1.8.jar
https://repo1.maven.org/maven2/com/neenbedankt/gradle/plugins/android-apt/plugins-android-apt.pom
https://repo1.maven.org/maven2/com/neenbedankt/gradle/plugins/android-apt/plugins-android-apt-1.8.jar
Required by:
:MaterialQuoter:unspecified
I'm probably making some sort of ridiculous mistake (I mean, those libraries would not see any use otherwise, right?), but I can't see what I'm doing wrong.
I'm running Android Studio 1.4, in case it's somehow relevant.
This is the gradle file for the project:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.neenbedankt.gradle:plugins:android-apt:1.8'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
mavenLocal()
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
dependencies {
compile 'com.github.hotchemi:permissionsdispatcher:1.2.1'
apt 'com.github.hotchemi:permissionsdispatcher-processor:1.2.1'
}
This is the gradle file for the module I'm mostly working on:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.callisto.materialquoter"
multiDexEnabled true
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/license.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/notice.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/ASL2.0'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.google.code.findbugs:jsr305:1.3.9'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.github.hotchemi:permissionsdispatcher:1.2.1'
compile 'org.roboguice:roboguice:3.+'
provided 'org.roboguice:roboblender:3.+'
compile 'org.codepond:wizardroid:1.3.0'
compile ('com.octo.android.robospice:robospice:1.4.14') {
exclude group: 'org.apache.commons', module: 'commons-io'
}
compile ('com.octo.android.robospice:robospice-cache:1.4.14') {
exclude group: 'org.apache.commons', module: 'commons-io'
}
compile ('com.octo.android.robospice:robospice-spring-android:1.4.14') {
exclude group: 'org.apache.commons', module: 'commons-io'
}
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
compile 'de.greenrobot:greendao:2.0.0'
}
I had the same problem. This helped me to figure it out.
On the app module itself, add these lines (order is important):
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
dependencies {
compile 'com.github.hotchemi:permissionsdispatcher:1.2.1#aar'
apt 'com.github.hotchemi:permissionsdispatcher-processor:1.2.1'
}
As of the Android Gradle plugin version 2.2, all functionality that was previously provided by android-apt is now available in the Android plugin. This means that android-apt is officially obsolete ;)
Thus,
Make sure you've updated your Gradle plugin to be >= 2.2
Instead of apt use annotationProcessor
Ref: https://bitbucket.org/hvisser/android-apt/wiki/Migration
I figured this way on Android Studio 2.2.1:
This lets me use Butterknife on the main project and also on the library at the same time.
Please note that, on the library, use R2.id.blah instead of R.id.blah when using Butterknife annotations.
Hope works for all.
Also check this link
1) project gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
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
}
2) app graddle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
...
}
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'
})
testCompile 'junit:junit:4.12'
...
//Butterknife https://github.com/JakeWharton/butterknife#library-projects
compile 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
...
}
3) library graddle file
apply plugin: 'com.android.library'
apply plugin: 'com.jakewharton.butterknife'
android {
compileSdkVersion 24
buildToolsVersion "25.0.0"
defaultConfig {
minSdkVersion 21
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//Butterknife
compile 'com.jakewharton:butterknife-annotations:8.4.0'
compile 'com.jakewharton:butterknife:8.4.0'
...
}