Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

更新 flutter 后打包正式版本无法更新 #29

Closed
aboutmydreams opened this issue Jan 8, 2021 · 3 comments
Closed

更新 flutter 后打包正式版本无法更新 #29

aboutmydreams opened this issue Jan 8, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@aboutmydreams
Copy link

aboutmydreams commented Jan 8, 2021

更新 flutter 后打包正式版本无法更新

对问题进行清晰而简明的描述,把握问题的关键点。

使用的flutter_xupdate版本:1.0.2

如何重现(必填)
重现的步骤:
cd ./android
./gradlew assembleRelease
打包成功
输出

Configure project :flutter_xupdate
WARNING: The option setting 'android.enableR8=true' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 34s

我的一些相关配置
如wiki-常见问题
我使用了原生打包,无论是否主动关闭R8压缩,都没有解决在手机上无法更新的问题
我的 build.grade :

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"
apply plugin: 'com.google.gms.google-services'

def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
    compileSdkVersion 30

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

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.yuque.vyan"
        minSdkVersion 17
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        // testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        ndk {
            abiFilters "arm64-v8a" //abiFilters "armeabi-v7a", "armeabi", "arm64-v8a", "x86"
        }
    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            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
        }
        debug {
            // signingConfig signingConfigs.release
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.google.firebase:firebase-analytics:17.2.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}

我的 gradle.properties

org.gradle.jvmargs=-Xmx1536M
android.enableD8=true
android.useAndroidX=true
android.enableJetifier=true
# android.enableR8=false

期望的效果
希望打包成功且release安装在手机上可以支持更新

设备信息

  • 设备名: vivo iqoo z1
  • Android版本: Android 10
  • 设备型号 V1986A
  • 系统版本 IQOOUI OD1986C_A_1.10.18
@aboutmydreams aboutmydreams added the bug Something isn't working label Jan 8, 2021
@xuexiangjys
Copy link
Owner

原生打包你也得配置混淆啊,详细自己看demo的配置

@winds1983
Copy link

我也是同样的问题,在模拟器上可以正常使用,但在真机上就不能工作了。

@shaoting0730
Copy link

me too.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants