0
我想在我的項目中使用firebase sdk,在這個項目中我無法同步gradle.I已將jdk從1.7更新爲1.8以及更新了谷歌存儲庫, Android SDK和工具latestt版本,但即使我得到錯誤,因爲無法加載類'com.google.gson.JsonObject'。未能在Android中同步螢火石的gradle在Android
項目搖籃:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
} allprojects {
repositories {
jcenter()
}
}
模塊搖籃:
apply plugin: 'com.android.application'
機器人{ 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'
}
}
packagingOptions{
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.firebase:firebase-client-android:2.4.0'
compile 'com.google.firebase:firebase-storage:9.2.1'
compile 'pub.devrel:easypermissions:0.1.9'
compile 'com.google.firebase:firebase-core:9.2.1'
compile 'com.google.firebase:firebase-auth:9.2.1'
}
apply plugin: 'com.google.gms.google-services'
錯誤:
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.
我已經完成但仍顯示相同的錯誤 –
你做了什麼? – AndroidMechanic
我有無效緩存並重新啓動android studio –