我尝试实施Google对“将Firebase添加到您的应用程序”的建议更改,该更改指出:
int position = lsearch(Arr,n,val);
if (position >= 0)
{
cout << "Item found at position " << position << endl;
}
else
{
cout << "Item not found" << endl;
}
但是进行了这些更改(尽管已更新为当前版本,即:服务现在是4.2.0,核心现在是16.0.9),但在尝试运行应用程序时出现以下错误:
The Google services plugin for Gradle loads the google-services.json file you just downloaded. Modify your build.gradle files to use the plugin.
Project-level build.gradle (<project>/build.gradle):
buildscript {
dependencies {
// Add this line
classpath 'com.google.gms:google-services:4.0.1'
}
}
App-level build.gradle (<project>/<app-module>/build.gradle):
dependencies {
// Add this line
implementation 'com.google.firebase:firebase-core:16.0.1'
}
...
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'
在此阶段,它似乎位于flutter SDK中。这是我的flutter.gradle文件(摘录):
* Error running Gradle:
ProcessException: Process "X:\Projects\Apps\Flutter\ultimate_mtg\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Script 'X:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 29
* What went wrong:
A problem occurred evaluating script.
> Could not find method android() for arguments [flutter_btx813u5j2ly3w9khjl576b0k$_run_closure1@6f90a486] on project ':app' of type org.gradle.api.Project.
第29行是此行:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
}
}
android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
有人对此有任何想法吗?我已经阅读了许多类似的主题,但没有任何建议对我有用。
有关其他信息,请访问我的\ build.gradle文件:
android {
还有我的\ app \ build.gradle文件:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}