热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

将Firebase添加到调用Microsoft图形的项目中时出错

我正在尝试将Firebase添加到涉及添加以下内容的现有应用程序中:classpath'com.googl

我正在尝试将Firebase添加到涉及添加以下内容的现有应用程序中:

classpath 'com.google.gms:google-services:4.3.3'

作为对项目级别build.gradle的依赖,并添加:

apply plugin: 'com.google.gms.google-services'

作为应用程序级别build.gradle的插件。

我正在构建的项目是“登录/注销用户并从Android应用程序调用microsoft Graph”

https://docs.microsoft.com/en-us/azure/active-directory/develop/tutorial-v2-android

项目级别build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
apply from: rootProject.file("gradle/versions.gradle")
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:$rootProject.ext.gradleVersion"
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

应用程序级别build.gradle

apply plugin: 'com.android.application'
allprojects {
repositories {
mavenCentral()
google()
mavenLocal()
maven {
name "vsts-maven-adal-android"
url "https://identitydivision.pkgs.visualstudio.com/_packaging/AndroidADAL/maven/v1"
credentials {
username System.getenv("ENV_VSTS_MVN_ANDROIDADAL_username") != null ? System.getenv("ENV_VSTS_MVN_ANDROIDADAL_username") : project.findProperty("vstsusername")
password System.getenv("ENV_VSTS_MVN_ANDROIDADAL_accESSTOKEN") != null ? System.getenv("ENV_VSTS_MVN_ANDROIDADAL_accESSTOKEN") : project.findProperty("vstsMavenaccessToken")
}
}
jcenter()
}
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationid "[com.*.*]"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
signingConfigs {
debug {
storeFile file("../gradle/debug.keystore")
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro'
}
}
flavorDimensions "main"
productflavors {
local {
// To be used with android-complete only.
// So that it could look for the 'local' flavor in Broker projects.
matchingFallbacks = ['local']
}
external {}
}
}
dependencies {
implementation fileTree(dir: 'libs',include: ['*.jar'])
implementation "androidx.appcompat:appcompat:$rootProject.ext.appCompatVersion"
implementation "com.google.android.material:material:$rootProject.ext.materialVersion"
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.android.volley:volley:1.1.1'
if (findProject(':msal') != null) {
// For developer team only.
localImplementation project(':msal')
externalImplementation 'com.microsoft.identity.client:msal:1.0.+'
} else {
// Downloads and Builds MSAL from maven central.
implementation 'com.microsoft.identity.client:msal:1.0.+'
}
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
}
apply plugin: 'com.google.gms.google-services'

下面是versions.gradle

// Variables for entire project
ext {
// SDK
minSdkVersion = 16
automatiOnAppMinSDKVersion= 21
targetSdkVersion = 27
compileSdkVersion = 28
buildToolsVersion = "28.0.3"
// Plugins
gradleVersion = '3.2.1'
androidMavenGradlePluginVersion = "1.4.1"
// libraries
annotatiOnVersion= "1.0.0"
appCompatVersion = "1.0.2"
browserVersion = "1.0.0"
dexmakerMockitoVersion = "1.4"
espressoCoreversion = "3.1.0"
gsOnVersion= "2.8.5"
junitVersion = "4.12"
legacySupportV4Version = "1.0.0"
localBroadcastManagerVersion = "1.0.0"
materialVersion = "1.0.0"
mockitoCoreversion = "2.18.3"
mockitoAndroidVersion = "2.18.3"
multidexVersion = "2.0.1"
powerMockVersion = "1.6.6"
nimbusVersion = "5.7"
runnerVersion = "1.2.0"
rulesVersion = "1.2.0"
// TODO: adal automation test app.
supportlibraryVersion = "27.1.+"
adalLegacy = "1.15.0"
}

同步项目时出错

org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
Caused by: org.gradle.api.GradleScriptException: A problem occurred evaluating project ':app'.
Caused by: java.lang.NoSuchFieldError: ASCII
at com.android.build.gradle.BasePlugin.checkPathForErrors(BasePlugin.java:1006)
at com.android.build.gradle.BasePlugin.apply(BasePlugin.java:261)
at com.android.build.gradle.AbstractAppPlugin.apply(AbstractAppPlugin.java:122)
at com.android.build.gradle.AppPlugin.apply(AppPlugin.java:43)



我有同样的问题。我可以使用类路径“ com.google.gms:google-services:4.0.0”而不是类路径“ com.google.gms:google-services:4.3.3”来解决。进行构建以查看另一种类型的错误。然后使缓存无效,然后从“文件”菜单在Android Studio上重新启动。然后在重新启动时,您的构建应该会成功。您可能还需要使用“ com.google.firebase:firebase-analytics:16.0.0”代替当前版本


推荐阅读
author-avatar
zjjj-jz政
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有