Reputation: 77
I am using firebase sdk in android in which i am getting an error as unable to load class 'com.google.Gson.JsonObject'.Even i have changed the jdk from 1.7 to 1.8 but it didn't works.Anyone knows why it is not synchronized.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "nidhinkumar.firebaseexample"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} }
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.0.0-alpha1'
compile 'com.google.firebase:firebase-core:9.2.1'
} apply plugin: 'com.google.gms.google-services'
Error:
Error:Unable to load class 'com.google.gson.JsonObject'.
Possible causes for this unexpected error include:<ul><li>Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) <a href="syncProject"> Re-download dependencies and sync project (requires network)</a></li><li>The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.<a href="stopGradleDaemons">Stop Gradle build processes (requires restart)</a></li></ul>In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
Upvotes: 3
Views: 628
Reputation: 480
i have also gone through same problem but after updating this repository it will work just update the tick marked file to latest then it will work
Upvotes: 1
Reputation: 1296
Add the following block inside your build.gradle,
//Add the following block
packagingOptions{
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
And in your dependencies add this one,
//Adding Firebase
compile 'com.firebase:firebase-client-android:2.4.0'
Upvotes: 0