Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android MissingPluginException(在channel plugins.flatter.io/shared_preferences上找不到方法getAll的实现)-现有解决方案没有';行不通-_Android_Flutter_Dart_Build.gradle_Proguard - Fatal编程技术网

Android MissingPluginException(在channel plugins.flatter.io/shared_preferences上找不到方法getAll的实现)-现有解决方案没有';行不通-

Android MissingPluginException(在channel plugins.flatter.io/shared_preferences上找不到方法getAll的实现)-现有解决方案没有';行不通-,android,flutter,dart,build.gradle,proguard,Android,Flutter,Dart,Build.gradle,Proguard,我正在构建一个使用这些包的应用程序 firebase_核心:^0.5.0 firebase_分析:^5.0.16 云存储: firebase_消息:^7.0.0 颤振本地通知:^1.4.4+2 提供程序:^4.3.1 http:^0.12.2 查看\u滑块:^1.0.5 颤振屏幕util:^2.3.0 共享的首选项:^0.5.12 滚动到索引:^1.0.6 firebase_数据库:^4.0.0 图像选取器:^0.6.7+11 获取:^3.11.1 在调试模式下,一切都很正常,但是当我构建一

我正在构建一个使用这些包的应用程序

  • firebase_核心:^0.5.0
  • firebase_分析:^5.0.16
  • 云存储:
  • firebase_消息:^7.0.0
  • 颤振本地通知:^1.4.4+2
  • 提供程序:^4.3.1
  • http:^0.12.2
  • 查看\u滑块:^1.0.5
  • 颤振屏幕util:^2.3.0
  • 共享的首选项:^0.5.12
  • 滚动到索引:^1.0.6
  • firebase_数据库:^4.0.0
  • 图像选取器:^0.6.7+11
  • 获取:^3.11.1
在调试模式下,一切都很正常,但是当我构建一个版本时,我得到了一个错误,我已经搜索了3天,所有我发现你需要的

flutter clean
pub get/ pub upgrade
然后它的工作谎言魅力。但这对我不起作用

这里是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 plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 28

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
        checkReleaseBuilds false
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.zonedelivery.zonedelivery"
        minSdkVersion 16
        targetSdkVersion 28
        multiDexEnabled true
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }

    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.release
            minifyEnabled true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.release
            minifyEnabled true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.firebase:firebase-firestore-ktx:21.5.0'
    implementation 'com.google.firebase:firebase-messaging:20.2.3'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.google.firebase:firebase-analytics:17.5.0'
}

apply plugin: 'com.google.gms.google-services'
## Flutter wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.**  { *; }
-keep class io.flutter.util.**  { *; }
-keep class io.flutter.view.**  { *; }
-keep class io.flutter.**  { *; }
-keep class io.flutter.plugins.**  { *; }
-keep class io.flutter.plugins.sharedpreferences**  { *; }
-dontwarn io.flutter.embedding.**

## Gson rules
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-dontwarn sun.misc.**
#-keep class com.google.gson.stream.** { *; }

# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * extends com.google.gson.TypeAdapter
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
  @com.google.gson.annotations.SerializedName <fields>;
}

## flutter_local_notification plugin rules
-keep class com.dexterous.** { *; }
proguard rules.pro文件

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 plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 28

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
        checkReleaseBuilds false
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.zonedelivery.zonedelivery"
        minSdkVersion 16
        targetSdkVersion 28
        multiDexEnabled true
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }

    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.release
            minifyEnabled true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.release
            minifyEnabled true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.firebase:firebase-firestore-ktx:21.5.0'
    implementation 'com.google.firebase:firebase-messaging:20.2.3'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.google.firebase:firebase-analytics:17.5.0'
}

apply plugin: 'com.google.gms.google-services'
## Flutter wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.**  { *; }
-keep class io.flutter.util.**  { *; }
-keep class io.flutter.view.**  { *; }
-keep class io.flutter.**  { *; }
-keep class io.flutter.plugins.**  { *; }
-keep class io.flutter.plugins.sharedpreferences**  { *; }
-dontwarn io.flutter.embedding.**

## Gson rules
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-dontwarn sun.misc.**
#-keep class com.google.gson.stream.** { *; }

# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * extends com.google.gson.TypeAdapter
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
  @com.google.gson.annotations.SerializedName <fields>;
}

## flutter_local_notification plugin rules
-keep class com.dexterous.** { *; }
##颤振包装器
-保持类io.flatter.app.*{*;}
-保持类io.flatter.plugin.*{*;}
-保持类io.flatter.util.*{*;}
-保持类io.flatter.view.*{*;}
-保持类io.flatter.*{*;}
-保持类io.flatter.plugins.*{*;}
-保持类io.flatter.plugins.SharedReferences**{*;}
-dontwarn io.flatter.com**
##格森规则
#Gson在处理字段时使用存储在类文件中的泛型类型信息。前卫
#默认情况下删除此类信息,因此将其配置为保留所有信息。
-保留署名
#用于使用GSON@Expose注释
-keepattributes*注释*
#Gson特定类
-dontwarn sun.misc**
#-保持类com.google.gson.stream.*{*;}
#防止proguard从TypeAdapter、TypeAdapterFactory、,
#JsonSerializer、JsonDeserializer实例(因此可以在@JsonAdapter中使用)
-keep class*扩展com.google.gson.TypeAdapter
-keep类*实现com.google.gson.TypeAdapterFactory
-keep class*实现com.google.gson.JsonSerializer
-keep类*实现com.google.gson.JsonDeserializer
#防止R8使数据对象成员始终为空
-keepclassmembers,AllowFusion类*{
@com.google.gson.annotations.SerializedName;
}
##颤振\u本地\u通知插件规则
-保持类com.dexterous.*{*;}

尝试将get\u it版本降级为: 获取它:^3.0.3 然后在命令窗口中写入: 扑通
然后重新安装应用程序

尝试将get\u it版本降级至: 获取它:^3.0.3 然后在命令窗口中写入: 扑通
然后重新安装应用程序

问题是缩小应用程序删除了一些重要代码,因此必须在proguard文件中解决它,因此我在proguard文件的底部添加了这一行

-keepclasseswithmembers class * {*;}
因此,它保留了所有类和函数,而不删除任何代码
这对我很有帮助

问题是收缩应用程序删除了一些重要代码,因此必须在proguard文件中解决它,因此我在proguard文件的底部添加了这一行

-keepclasseswithmembers class * {*;}
因此,它保留了所有类和函数,而不删除任何代码
这对我有帮助

仍然是同样的问题仍然是同样的问题这回答了你的问题吗?这回答了你的问题吗?