I made following upgrades today
Android Studio 3.0 -> 3.1
In build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1' -> 3.1.0
}
In gradle/wrapper/gradle-wrapper.properties
distributionUrl=https://services.gradle.org/distributions/gradle-4.5-all.zip -> gradle-4.6-all.zip
And I am now getting following error with my firebase modules (random module at a time when I build)
Failed to find byte code for
com/google/firebase/storage/StreamDownloadTask$StreamProcessor
or sometimes
Failed to find byte code for
com/google/firebase/database/ChildEventListener
My project implements
dependencies {
compile 'com.google.android.gms:play-services-base:11.8.0'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-auth:11.8.0'
compile 'com.google.firebase:firebase-firestore:11.8.0'
compile 'com.google.firebase:firebase-invites:11.8.0'
compile "com.google.firebase:firebase-messaging:11.8.0"
compile 'com.google.android.gms:play-services-auth:11.8.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:26.1.0'
}
I have the same error
Failed to find byte code for com/google/firebase/database/Transaction$Handler
(although i don't use firebase/database).
Have found that disabling instant run in AndroidStudio settings resolve this issue.
This is addressed in the latest react-native-firebase v4 release candidate, available here: https://github.com/invertase/react-native-firebase/releases/tag/v4.0.0-rc.3
The fix was ultimately to update the react-native-firebase build.gradle to use compileOnly instead of compile statements.
In the dependencies add:
compile 'com.google.firebase:firebase-database:11.8.0'
compile 'com.google.firebase:firebase-storage:11.8.0'
to be able to use ChildEventListener and StreamDownloadTask$StreamProcessor
Also you may have to write the other firebase dependencies
Related
I have been developing and working on my App, I then decided to build the APK I then got duplicate file error specifically talking about firebase zzc.class? which I could not find. I have seen duplicate file error before and sorted it out but this Firebase error has really slowed down my work because I have seen no specific answer to my issue.
Below are my dependencies
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 'com.android.support:appcompat-v7:25.+'
compile 'com.android.support:support-v4:25.+'
compile 'com.android.support:design:25.+'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.firebaseui:firebase-ui:2.0.1'
compile 'org.apache.pdfbox:pdfbox:2.0.0'
compile 'net.igenius:customcheckbox:1.3'
compile 'com.roger.catloadinglibrary:catloadinglibrary:1.0.1'
testCompile 'junit:junit:4.12'
}
Then the error:
You are using different versions of the same libraries:
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.firebaseui:firebase-ui:2.0.1'
As you can read here there is a dependency between firebaseui and firebase libraries:
FirebaseUI Version Firebase/Play Services Version
2.3.0 11.0.4
2.2.0 11.0.4
2.1.1 11.0.2
2.0.1 11.0.1
Use the same version to avoid these issue.
Also there is no reason to use the old:
compile 'com.firebase:firebase-client-android:x.x.x'
Check the migration guide and use:
compile "com.google.firebase:firebase-database:X.X.X"
Keep in mind that the latest version requires the google maven repo:
allprojects {
// ...
dependencies {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
This is happening because you have a duplicate in your build.gradle file. To solve this, you need to remove the following line of code:
compile 'com.firebase:firebase-client-android:2.3.1'
You cannot mix the old version of dependency with the new one.
Make sure to update firebase version to latest available version in your build(app) configuration exactly mentioned in the firebase documentation.
[https://firebase.google.com/docs/android/setup/]
If you are using play services make sure that the version of firebase library should be exactly same as of play services version.
compile 'com.google.android.gms:play-services:11.2.0'
compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.firebase:firebase-messaging:11.2.0'
If there is a library conflict then add gradle as:
defaultConfig {
multiDexEnabled true
}
and in your baseapplication
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
I am getting Error:This Gradle plugin requires Studio 3.0 minimum when importing project
Project repo: https://github.com/chrisbanes/cheesesquare
I had tried mentioned solution provided here and here but nothing worked :(
The repository you're trying to import uses gradle build tools 3.0.0 and gradle 4.0. These aren't supported in Android Studio 2.3, which means that project can only be opened in Android Studio 3.0 preview.
Your options:
1) Download android studio 3.0 preview and use it for the project
2) Check out repository and revert it to just before commit 822b84a1e58126412f708745d8bcee5a525620ae (which is where the conversion to latest version of gradle happened)
Option #1: Do not attempt to import the project until you upgrade to Android Studio 3.0
Option #2: Modify the project:
Change the project-level build.gradle to refer to com.android.tools.build:gradle:2.3.3 instead of com.android.tools.build:gradle:3.0.0-alpha6
Change gradle/wrapper/gradle-wrapper.properties to refer to https\://services.gradle.org/distributions/gradle-3.3-all.zip instead of https\://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip
Import the project and pray that its author is not depending on things that you changed
replace
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
with
classpath 'com.android.tools.build:gradle:2.3.3'
in the projects build.gradle files.
this Error occurs when you are trying to import Project which is created in studio 3.0 and above into Android Studio 2.3.3 or below. make following changes to work in Studio below 3
1)in Project gradle add below configuration:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
2) in App (or module) gradle file
remove following lines if there are any
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
and change all implementation and annotationProcessor in dependency to compile like below
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'android.arch.lifecycle:runtime:1.0.0'
implementation 'android.arch.lifecycle:extensions:1.0.0-alpha9-1'
annotationProcessor "android.arch.lifecycle:compiler:1.0.0-alpha9-1"
implementation 'android.arch.persistence.room:runtime:1.0.0-alpha9-1'
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha9-1"
implementation 'android.arch.paging:runtime:1.0.0-alpha1'
implementation 'com.android.support:recyclerview-v7:26.0.2'
}
To
dependencies {
//implementation fileTree(include: ['*.jar'], dir: 'libs')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'android.arch.lifecycle:runtime:1.0.0'
compile 'android.arch.lifecycle:extensions:1.0.0-alpha9-1'
compile "android.arch.lifecycle:compiler:1.0.0-alpha9-1"
compile 'android.arch.persistence.room:runtime:1.0.0-alpha9-1'
compile "android.arch.persistence.room:compiler:1.0.0-alpha9-1"
compile 'android.arch.paging:runtime:1.0.0-alpha1'
compile 'com.android.support:recyclerview-v7:26.0.2'
}
I was facing the same issue, it can be resolved by changing the gradle and android plugin version using following steps.
File -> Project Structure -> Project -> change gradle version to 3.3 and android plugin version to the android studio version you are using. -> Rebuild your project.
It may give some error for methods which were not in previous gradle versions. One that you mentioned in one of your comment GradleError:(25, 0) Gradle DSL method not found: 'implementation()' can be resolved by replacing implementation by compile.
May be you have resolved you issue but may help others.
Once I downloaded the project created in Android Studio v3 and I had v2.3.3. So when I tried to launch the project there were some incompatibility issues. And for those who faced the same problem the solution is the following:
1. Go to File=> Project Structure=> Project and change Gradle version to 3.3 and Android Plugin version to 2.3.3
2. In CinemaProject build.gradle file:
2.1. Delete "google()" methods wherever you see it in the file
2.2. Change allprojects section in the file like that:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
In app build.gradle file :
Add buildToolsVersion "26.0.0" in android {} section after compileSdkVersion
Change the following
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.code.gson:gson:2.8.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
Like that
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.mcxiaoke.volley:library:1.0.1'
compile 'com.google.code.gson:gson:2.7'
testCompile 'junit:junit:4.12'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
}
hi guys i solve this issue i want to explain you you check your android studio ide version first this is the reason if you using ide 1.5 then you cant use gradle version 3.0+.
I add this library to my gradle file:
compile 'com.commit451:PhotoView:1.2.5'
but every time I compile PhotoView library, I get this error:
Error:Could not find com.android.support:support-v4:23.2.1.
I downloaded the new "Android Support Library 23.2.1 from android SDK manager
but I still get the error. this is really annoying I need help.
my dependencies:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.parse:parseui-login-android:0.0.1'
compile 'com.parse:parseui-widget-android:0.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.parse:parse-android:1.13.0'
compile 'com.commit451:PhotoView:1.2.5'
}
same issue here - solved by updating "Local Maven repository for Support Libraries" to rev. 28 (i updated via Standalone SDK Manager)
and as mentioned before, every com.android.support:xxx dependency should have the same version.
after adding Sugar ORM dependency to gradle script app file
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.github.satyan:sugar:1.4'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:design:23.1.1'
}
Gradle complied my project, but once I tried to run it in a physical device (via Android studio) I got this error :
Error:Your app has more methods references than can fit in a single dex file.
See https://developer.android.com/tools/building/multidex.html
There are now errors If I tried to compile and run the app with Sugar ORM 1.3
Has the library grown so large in version 1.4 it will no longer fit into a single DEX ?
Try to enable multiDex support by using:
defaultConfig {
multiDexEnabled true
}
in your build.gradle (app)
Hope this help!
I've tried any solution suggested trying to solved the aapt.exe error.
every time I'm trying to add a new dependency to the build.gradle I get this error and after removing the dependency the error disappear.
I've tried chnging the compile SDK, changing the build tools version, invalidate/clear cache, activating compile independent modules in parallel.
The only dependencies registered are:
signingConfigs { compile fileTree(include: '*.jar', dir: 'libs')
compile project(':android-support-v7-appcompat')
compile files('libs/android-integration-3.2.1.jar')
compile files('libs/android-core-3.2.1.jar')
How can I handle it if I need to add another dependency to my project?
I'm working on android studio 1.4.1
compileSdkVersion 19
buildToolsVersion '22.0.1'
you should be adding your dependency libraries in build.gradle in (Module:app), if you are adding any library using Android studio GUI it will end up adding that library in this place or if you manually place a library in libs and add it to project as library it will still be added here.
Kindly check where and how are you adding your dependency
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.google.code.gson:gson:2.4'
compile files('libs/commons-io-2.4.jar')
}
in above code gson library is added compile 'com.google.code.gson:gson:2.4' is added using android studio GUI and
apache common io is added compile files('libs/commons-io-2.4.jar')
by placing it's library in libs directory in the Android project