2

在那之前我还没有解决华为登录链接的问题:https ://forums.developer.huawei.com/forumPortal/en/topic/0201616708664590094?fbclid=IwAR2j7upjI62ISMICdVh9_MgArtzVbAFMXJ26vpfSh3t5wZ991tOuOsF06D8 在调试模式下我在模拟器上运行我的电脑。为了解决它,我尝试使用云调试,当使用云调试时,我必须构建我的项目以使其成为应用程序,然后当我尝试构建它时,我发现如下错误

* What went wrong: Execution failed for task ':app:minifyReleaseWithR8'.   com.android.tools.r8.CompilationFailedException: Compilation failed to complete

* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 29s Running Gradle task 'bundleRelease'...         
90.2s [!] The shrinker may have failed to optimize the Java bytecode.
    To disable the shrinker, pass the `--no-shrink` flag to this command.
    To learn more, see: https://developer.android.com/studio/build/shrink-code Gradle task bundleRelease failed with exit code 1

然后我尝试查找包中是否有错误,当我尝试拔下华为帐户包时,会发生这种情况

拔掉插头

接下来,我尝试更改 Gradle 版本,因为如前所述,有一条日志显示

此版本中使用了已弃用的 Gradle 功能,使其与 Gradle 7.0 不兼容。

然后看看会发生什么

堵塞

我只是不知道该怎么办,因为如果它仍然发生,我无法使用帐户工具包发布应用程序

这是我最新的 build.gradle

APP级别

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 30

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    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.gky_cmn"
        minSdkVersion 20
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

    signingConfigs {       
       release {            
           keyAlias keystoreProperties['keyAlias']
           keyPassword keystoreProperties['keyPassword']
           storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
           storePassword keystoreProperties['storePassword']        
       }    
   }   
 
   buildTypes {        
       debug {            
           signingConfig signingConfigs.config        
        }       
        release {  
           minifyEnabled true
            shrinkResources true
           proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
           signingConfig signingConfigs.config        
       }    
    }

}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

apply plugin: 'com.huawei.agconnect'

安卓级别

buildscript {
    ext.kotlin_version = '1.4.32'
    repositories {
        google()
        mavenCentral()
        maven {url 'https://developer.huawei.com/repo/'}
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.huawei.agconnect:agcp:1.4.1.300'
        classpath 'com.google.gms:google-services:3.2.1'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven {url 'https://developer.huawei.com/repo/'}
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

日志 --verbose https://ghostbin.com/paste/bkCr2

4

1 回答 1

0

我在华为论坛上阅读了您的问题。根据日志,您的测试设备上没有安装 HMS Core。实际上,HMS SDK提供了HMS Core的下载安装功能。你可以参考文档在此处输入图像描述

于 2021-07-21T02:00:24.870 回答