在将流动依赖项添加到我的应用程序后,shared_preferences,image_picker,uuid,image,path_provider,font_awesome_flutter,async,http:any,cached_network_image,firebase_storage在控制台页面显示错误。 我的控制台错误低于.... ######################################### ################################################ ################################################ ################################################ ################################################ ###################################
E/AndroidRuntime( 9302): FATAL EXCEPTION: TokenRefresher
E/AndroidRuntime( 9302): Process: com.testhhitan.testhhitan, PID: 9302
E/AndroidRuntime( 9302): java.lang.NoSuchFieldError: No field PREFER_HIGHEST_OR_REMOTE_VERSION_NO_FORCE_STAGING of type Lcom/google/android/gms/dynamite/DynamiteModule$VersionPolicy; in class Lcom/google/android/gms/dynamite/DynamiteModule; or its superclasses (declaration of 'com.google.android.gms.dynamite.DynamiteModule' appears in /data/app/com.testhhitan.testhhitan-1/base.apk:classes2.dex)
E/AndroidRuntime( 9302): at com.google.android.gms.flags.FlagValueProvider.initialize(Unknown Source)
E/AndroidRuntime( 9302): at com.google.android.gms.flags.FlagRegistry.initialize(Unknown Source)
E/AndroidRuntime( 9302): at com.google.firebase.auth.internal.zzx.initialize(Unknown Source)
E/AndroidRuntime( 9302): at com.google.firebase.auth.internal.zzt.run(Unknown Source)
E/AndroidRuntime( 9302): at android.os.Handler.handleCallback(Handler.java:836)
E/AndroidRuntime( 9302): at android.os.Handler.dispatchMessage(Handler.java:103)
E/AndroidRuntime( 9302): at android.os.Looper.loop(Looper.java:203)
E/AndroidRuntime( 9302): at android.os.HandlerThread.run(HandlerThread.java:61)
D/GraphicBuffer( 9302): register, handle(0x6fcc25a1c0) (w:720 h:1344 s:720 f:0x1 u:0x000b00)
V/NativeCrypto( 9302): Registering com/google/android/gms/org/conscrypt/NativeCrypto's 284 native methods...
D/GraphicBuffer( 9302): register, handle(0x6fc953da40) (w:720 h:1344 s:720 f:0x1 u:0x000b00)
I/ProviderInstaller( 9302): Installed default security provider GmsCore_OpenSSL
I/Process ( 9302): Sending signal. PID: 9302 SIG: 9
我的pubspec.yaml ########################################## ################################################ ################################################ ################################################ ################################################ #
name: testhhitan
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
firebase_storage:
cupertino_icons: ^0.1.2
firebase_auth:
firebase_core:
firebase_database:
flutter_facebook_login:
cloud_firestore:
shared_preferences:
image_picker:
uuid:
image:
path_provider:
font_awesome_flutter:
async:
http: any
cached_network_image:
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
build.gradle代码.....
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.2'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
subprojects{
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group =='com.android.support'
&& !details.requested.name.contains('multidex')){
details.useVersion "26.0.1"
}
}
}
}
app build.gradle ....
#def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 27
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.testhhitan.testhhitan"
minSdkVersion 16
targetSdkVersion 27
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
api 'com.android.support:multidex:1.0.1'
}
//configurations.all {
// resolutionStrategy{
// force "com.android.support:support-v4:27.1.1"
// }
//}
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
说明在下面... ######################################### ################################################ ################################################ ################################################ ################################################ ################################################ ############################
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.testhhitan.testhhitan">
<!-- The INTERNET permission is required for development. Specifically,
flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="hhitan_test"
android:icon="@mipmap/ic_launcher">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id"/>
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name" />
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="@string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
</application>
</manifest>