我正在使用Firebase GMS服务开发Android应用程序
我试着按照他们的教程,按照他们说的做了项目,下载了json文件。
但是当我尝试将我的应用程序连接到Firebase时。他们告诉我错误
无法解析Android应用程序模块的Gradle配置。解决gardle build issuse和/或resync。
但是我认为我的成绩脚本是完美的(我会将它们写在页面底部)
这是我的成绩构建控制台
Executing tasks: [:app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources]
Configuration on demand is an incubating feature.
WARNING: WARNING: Dependency org.json:json:20090211 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency org.json:json:20090211 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency org.json:json:20090211 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency org.json:json:20090211 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency org.json:json:20090211 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency org.json:json:20090211 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency org.json:json:20090211 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency org.json:json:20090211 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2400Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72400Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72400Library UP-TO-DATE
:app:prepareComAndroidSupportPaletteV72400Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42400Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2400Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices980Library
:app:prepareComGoogleAndroidGmsPlayServicesAds980Library
:app:prepareComGoogleAndroidGmsPlayServicesAdsLite980Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics980Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl980Library
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing980Library
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite980Library
:app:prepareComGoogleAndroidGmsPlayServicesAuth980Library
:app:prepareComGoogleAndroidGmsPlayServicesAuthBase980Library
:app:prepareComGoogleAndroidGmsPlayServicesAwareness980Library
:app:prepareComGoogleAndroidGmsPlayServicesBase980Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast980Library
:app:prepareComGoogleAndroidGmsPlayServicesCastFramework980Library
:app:prepareComGoogleAndroidGmsPlayServicesClearcut980Library
:app:prepareComGoogleAndroidGmsPlayServicesDrive980Library
:app:prepareComGoogleAndroidGmsPlayServicesFitness980Library
:app:prepareComGoogleAndroidGmsPlayServicesGames980Library
:app:prepareComGoogleAndroidGmsPlayServicesGass980Library
:app:prepareComGoogleAndroidGmsPlayServicesGcm980Library
:app:prepareComGoogleAndroidGmsPlayServicesIdentity980Library
:app:prepareComGoogleAndroidGmsPlayServicesIid980Library
:app:prepareComGoogleAndroidGmsPlayServicesInstantapps980Library
:app:prepareComGoogleAndroidGmsPlayServicesLocation980Library
:app:prepareComGoogleAndroidGmsPlayServicesMaps980Library
:app:prepareComGoogleAndroidGmsPlayServicesNearby980Library
:app:prepareComGoogleAndroidGmsPlayServicesPanorama980Library
:app:prepareComGoogleAndroidGmsPlayServicesPlaces980Library
:app:prepareComGoogleAndroidGmsPlayServicesPlus980Library
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet980Library
:app:prepareComGoogleAndroidGmsPlayServicesTagmanager980Library
:app:prepareComGoogleAndroidGmsPlayServicesTagmanagerApi980Library
:app:prepareComGoogleAndroidGmsPlayServicesTasks980Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesVision980Library
:app:prepareComGoogleAndroidGmsPlayServicesWallet980Library
:app:prepareComGoogleAndroidGmsPlayServicesWearable980Library
:app:prepareComGoogleFirebaseFirebaseAnalytics980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuth980Library
:app:prepareComGoogleFirebaseFirebaseAuthCommon980Library
:app:prepareComGoogleFirebaseFirebaseAuthModule980Library
:app:prepareComGoogleFirebaseFirebaseCommon980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseConfig980Library
:app:prepareComGoogleFirebaseFirebaseCore980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCrash980Library
:app:prepareComGoogleFirebaseFirebaseDatabase980Library
:app:prepareComGoogleFirebaseFirebaseDatabaseConnection980Library
:app:prepareComGoogleFirebaseFirebaseIid980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseMessaging980Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseStorage980Library
:app:prepareComGoogleFirebaseFirebaseStorageCommon980Library
:app:prepareComTsengvnTypekit100Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
Parsing json file: C:\Users\AJH322\AndroidStudioProjects\hanyang\app\src\debug\google-services.json
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:mockableAndroidJar UP-TO-DATE
:app:preDebugUnitTestBuild UP-TO-DATE
:app:prepareDebugUnitTestDependencies
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl UP-TO-DATE
:app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript UP-TO-DATE
:app:generateDebugAndroidTestBuildConfig UP-TO-DATE
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources UP-TO-DATE
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
BUILD SUCCESSFUL
Total time: 3 mins 14.678 secs
这是我的gradle脚本(模块)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.example.ajh322.hanyang"
minSdkVersion 15
targetSdkVersion 23
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')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.tsengvn:Typekit:1.0.0'
compile 'com.squareup.okhttp3:okhttp:3.4.2'
compile 'com.github.nkzawa:socket.io-client:0.3.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
项目gradle apply plugin:'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.example.ajh322.hanyang"
minSdkVersion 15
targetSdkVersion 23
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')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services:9.8.0'
compile 'com.tsengvn:Typekit:1.0.0'
compile 'com.squareup.okhttp3:okhttp:3.4.2'
compile 'com.github.nkzawa:socket.io-client:0.3.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
有人知道如何通过我的应用程序连接到Firebase?
请拯救我的生命...谢谢你
答案 0 :(得分:30)
我有完全相同的问题。我成功构建但在点击“连接到Firebase”时收到了相同的消息。通过助理按钮。
事实证明,我有一个警告,我必须修理才能让它发挥作用。
"按需配置是一项孵化功能。 警告:配置'编译'已经过时,已被“实施”所取代。和' api'。 它将在2018年底删除。有关详细信息,请参阅:http://d.android.com/r/tools/update-dependency-configurations.html"
我只需要用' api'来替换我的编译。然后它奏效了。即使您的构建成功,我也建议您查看修复警告。
答案 1 :(得分:16)
我尝试了很多方法,但最简单的方法是将com.google.gms:google-services
从3.1.1更新为3.2.0
答案 2 :(得分:6)
我怀疑你项目中的gzips可能是罪魁祸首。在项目文件夹中搜索并删除它们,让gradle为您重新同步。
可能的替代解决方案: https://github.com/socketio/engine.io-client-java/issues/13 https://github.com/ACRA/acra/issues/159
答案 3 :(得分:4)
转到应用程序build.gradle文件。将“ compile”替换为“ api”。然后,同步您的项目。警告应消失。这对我来说很好。
答案 4 :(得分:3)
好吧,您需要解决所有gradle构建问题。 转到gradle控制台(通常位于IDE的右下角)并检查错误/警告。一旦您的构建成功而没有错误,与firebase的连接应该可以正常工作。
答案 5 :(得分:3)
在build.gradle文件中,将'compile'替换为'implementation'和sync project。
答案 6 :(得分:3)
确保您的app / build.gradle没有过时的依赖关系和声明。我的问题是使用
dataBinding {
enabled = true
}
代替
buildFeatures{
dataBinding = true
}
答案 7 :(得分:3)
我最近更新到了Android Studio 4.0,并遇到了此错误。我仍在使用过时的方法来添加数据绑定。将其更改为使用数据绑定的更新方式解决了我的问题。下面是代码:
buildFeatures{
dataBinding = true
// for view binding :
// viewBinding = true
}
答案 8 :(得分:2)
我在build.gradle文件中遇到了一些其他错误。在评论下面的行后,它开始工作:
dexOptions
{
//incremental false
}
答案 9 :(得分:2)
第一种方法:- 只需REMOVE jcenter() 因为此存储库即将关闭,因此这会在与 firebase 连接时产生问题
repositories {
google()
mavenCentral()
// jcenter() // Warning: this repository is going to shut down soon
}
第二种方法:- 临时删除
id 'androidx.navigation.safeargs.kotlin'
在 build.gradle(module) 和
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5"
来自 build.gradle(project)
答案 10 :(得分:1)
在我的情况下,显示了以下警告:
API 'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()
因此,我无法连接到Firebase。
由gms服务4.3.0引起。所以我不得不将其更改为:
com.google.gms:google-services:4.2.0
我通过运行找到了这个
gradlew sync -Pandroid.debug.obsoleteApi = true
在终端中。在Android Studio中转到查看->工具窗口->终端。 Gms服务可能会在将来的版本中解决此问题。
答案 11 :(得分:1)
在build.gradle(Module.app)中 如果您使用视图绑定,请先对其进行评论,然后再进行同步!
/*
viewBinding {
enabled = true
}
*/
然后连接到Firebase。我使用AS 4.0。请打分,如果有帮助,谢谢!
答案 12 :(得分:0)
在Gradle文件中:
RuntimeError: Compilation failed: Compilation failure:
Detected unsupported operations when trying to compile graph
cluster_4125121914893370080[] on XLA_TPU_JIT: Placeholder
(No registered 'Placeholder' OpKernel for XLA_TPU_JIT devices compatible
with node {{node tpu_140154018445800/input_1}} Registered:
device='TPU'
device='CPU'
device='GPU'
device='XLA_CPU'
){{node tpu_140154018445800/input_1}}
这帮助了我。
答案 13 :(得分:0)
好吧,您需要从build.gradle中删除错误和警告。
您可以在以下位置轻松找到:构建标签(位于底部)->“同步”标签->在这里您可以找到问题
答案 14 :(得分:0)
任何人遇到此问题,我都可以通过以下方式解决: Android Studio-3.4.2
修复“构建”窗口中的所有警告。 将编译更改为“实现”和“ testImplementation”,“ androidTestImplementation”等
删除此行应用程序build.gradle: 应用插件:“ io.fabric”
答案 15 :(得分:0)
如果您正在使用gradle.properties中的databinding
,请删除此行
android.databinding.enableV2=true
答案 16 :(得分:0)
在我的清单中,删除节点
<application
android:name=".controller.AppController"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:usesCleartextTraffic="true"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
tools:node="replace"
android:theme="@style/AppTheme">
删除此行
tools:node="replace"
并替换为此
tools:replace="allowBackup"
答案 17 :(得分:0)
如果您正在使用gradle.properties中的数据绑定,请删除此行
android.databinding.enableV2=true
已经在应用gradle文件中启用了数据绑定
答案 18 :(得分:0)
我有同样的问题。我通过将sha-1代码更新到firebase控制台并从firebase重新导入google-json文件来解决了该问题。我发现的主要问题是,更新android studio后,sha-1或md5代码已更改。
答案 19 :(得分:0)
请注意是否正在使用:
android.enableR8 = true
暂时将其删除。那是我的错误。
答案 20 :(得分:0)
对我来说,解决方案是将所有“ compile'com.google ....”替换为“ implementation'com.google ...”
答案 21 :(得分:0)
在 build.gradle 文件中将 'compile' 替换为 'implementation' 并同步项目。 稍后谢谢我。
答案 22 :(得分:-1)
我遇到了同样的问题!当我使用Android Studio Firebase助手并点击“连接到Firebase”按钮时,我遇到了同样的问题。 解决方案很简单:忘记助手(显然,它有一些错误),只需按照手动将Firebase项目集成到Android Studio项目的指示(在Firebase控制台中创建项目,下载json文件并将其放入)在'app'文件夹内等) 不要忘记确保所有Firebase依赖项都具有相同的版本(例如11.8.0)。它对我有用。