gradle error while add sugar ORM 1.4 dependancy - android

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!

Related

Failed to find byte code for com/google/firebase

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

what is the reason to raise the error without using firebase in android

Error:
Process: com.xportsoft.epicsudoku, PID: 5380
java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions
Gradle file:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.google.android.gms:play-services:9.2.0'
}
defaultConfig {
.....
multiDexEnabled true
}
Don't use
compile 'com.google.android.gms:play-services:9.2.0'
dependency completely in your project. Use only specific library dependencies from google-play-services library that are required to your project. For example if you want use google places then use following line
compile 'com.google.android.gms:play-services-location:9.0.2'
Firebase is now part of the Google, so this problem was occurring in your project.
For more refer this Google Documentation

failed to resolve com.android.support:support-v4:23.2.1

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.

Compiling com.parse:parsefacebookutils leads to com.parse.Parse Class not found exception

I'm currently trying to add Facebooklogin capabilites to my App.
According to the Android Docs, when I add
compile 'com.parse:parsefacebookutils-v4-android:1.10.3#aar'
To my Build.gradle it should include the entire com.parse.Parse, com.parse.ParseObject... classes already. So I removed the compile for the normale parse-android and now my dependencies look like that:
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.google.android.gms:play-services-auth:8.3.0'
compile 'com.parse:parsefacebookutils-v4-android:1.10.3#aar'
//compile 'com.parse:parse-android:1.10.3' //Already include in parsefacebookutils
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
//NOTE: I do not actually have anything in my 'libs' folder.
BUT after doing so my Applicationclass (and every other Class) can't find the com.parse.Parse stuff. And the com.parse namespace only contains the 'ParseFacebookUtils' class.
I already tried:
compiling the 'com.parse:parse-android:1.10.3' in the dependencies, which only leads to the expected 'DexError' when deploying.
Removing the #aar at the end, which imported the com.parse namespace correctly, but lead to the Gradle error. I assume because the facebookutils have the parse-android:1.10.3 as dependency in their maven project. (http://mvnrepository.com/artifact/com.parse/parsefacebookutils-v4-android/1.10.3)
Warning:Module 'com.parse:parsefacebookutils-v4-android:1.10.3' depends on one or more Android Libraries but is a jar
sounds like there is a bug in the parsefacebookutils that is loaded. I can't say what it is but work around is that download the latest jar files and use them instead of loading.
Parse-1.11.0
ParseFacebookUtilsV4-1.10.3
those .jar files in library directory and remove the compile rows from build.gradle.
at least I'm getting forward with this.

finished with non-zero exit value error

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

Categories

Resources