1

我正在尝试构建我的颤振应用程序的 APK,但在运行时flutter build apk --split-per-abi我遇到了错误。看起来camera包裹有问题,我不知道sms:verifyReleaseResources指的是什么。我尝试了不同版本的camera包,但徒劳无功。

以前有没有其他人遇到过这个问题?我已按照本指南构建 apk https://flutter.dev/docs/deployment/android

 D:\CIIT GUIDE\Flutter\Apps\storeifie_new_admin_panel>flutter build apk --split-per-abi
    Parameter format not correct -
    Removed unused resources: Binary resource data reduced from 719KB to 693KB: Removed 3%
    Removed unused resources: Binary resource data reduced from 719KB to 693KB: Removed 3%
    Removed unused resources: Binary resource data reduced from 719KB to 693KB: Removed 3%
    Removed unused resources: Binary resource data reduced from 719KB to 693KB: Removed 3%
    Removed unused resources: Binary resource data reduced from 719KB to 693KB: Removed 3%
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':sms:verifyReleaseResources'.
    > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
       > Android resource linking failed
         C:\Users\faiza\.gradle\caches\transforms-2\files-2.1\44b1706abe044cd42dcac5be863451ed\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.
    
         C:\Users\faiza\.gradle\caches\transforms-2\files-2.1\44b1706abe044cd42dcac5be863451ed\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: resource android:attr/ttcIndex not found.
    
    
    * 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 8s
    Running Gradle task 'assembleRelease'...
    Running Gradle task 'assembleRelease'... Done                      69.4s
    The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve
    the incompatibility.
    Building plugin camera...
    Running Gradle task 'assembleAarRelease'...
    Running Gradle task 'assembleAarRelease'... Done                    5.3s
    
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    A problem occurred configuring root project 'camera'.
    > SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
    
    * 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 4s
    
    
    The plugin camera could not be built due to the issue above.

目录看起来像这样

在此处输入图像描述

下面是my key.properties

storePassword=xxxxxx
keyPassword=xxxxxx
keyAlias=key
storeFile=key.jks

android/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: 'com.google.gms.google-services'
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 29

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

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.appName"
        minSdkVersion 21
        targetSdkVersion 29
        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 {
       release {
           signingConfig signingConfigs.release
       }
   }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation platform('com.google.firebase:firebase-bom:26.0.0')
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'androidx.multidex:multidex:2.0.1'
}

android/build.gradle文件

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()  // Google's Maven repository
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.4'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

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

build目录

在此处输入图像描述

4

1 回答 1

0

我可以通过简单地从以下包中删除以下包来解决这个问题pubspec.yaml

otp: ^2.2.3

flutter_otp: ^0.3.2

于 2020-11-19T08:22:23.600 回答