lemonhello4android,Flutter build APK results in "resource android:attr/fontVariationSettings not fou...

I'm trying to create a signed APK in Flutter with Android Studio, in theory I already have all the steps ready to create the signed APK "https://flutter.dev/docs/deployment/android" but an error always pops up that prevents the apk from being created.

C:\Users\CryptoBrain\Desktop\app-Flutter\my_app>flutter build apk

You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.

If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.

To generate an app bundle, run:

flutter build appbundle --target-platform android-arm,android-arm64,android-x64

Learn more on: https://developer.android.com/guide/app-bundle

To split the APKs per ABI, run:

flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi

Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split

Running Gradle task 'assembleRelease'...

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':clipboard_manager:verifyReleaseResources'.

> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade

> 1 exception was raised by workers:

com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed

C:\Users\CryptoBrain\.gradle\caches\transforms-2\files-2.1\6c261a14fef7a6c9650e745991e1078b\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVar

iationSettings not found.

C:\Users\CryptoBrain\.gradle\caches\transforms-2\files-2.1\6c261a14fef7a6c9650e745991e1078b\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: resource android:attr/ttcInde

x 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 10m 59s

Running Gradle task 'assembleRelease'... 665,6s (!)

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 clipboard_manager...

Running Gradle task 'assembleAarRelease'... 59,7s

√ Built build\app\outputs\repo.

Building plugin majascan...

Running Gradle task 'assembleAarRelease'... 36,6s

√ Built build\app\outputs\repo.

Building plugin shared_preferences...

Running Gradle task 'assembleAarRelease'... 1,4s

Exception in thread "main" java.lang.NullPointerException

at org.gradle.wrapper.BootstrapMainStarter.findLauncherJar(BootstrapMainStarter.java:34)

at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:25)

at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)

at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)

The plugin shared_preferences could not be built due to the issue above.

C:\Users\CryptoBrain\Desktop\app-Flutter\my_app>

I already tried using the different versions of clipboard_manager there are 4 but they all give the same error.

Also change the com.android.tools.build:gradle:3.5.0 to com.android.tools.build:gradle:3.6.1 and the distributionUrl I have it in: https://services.gradle.org/distributions/gradle-5.6.4-all.zip

Here is the code I am using:

pubspec.yaml

name: app_name

description: my flutter app

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0+1

environment:

sdk: ">=2.7.0 <3.0.0"

dependencies:

flutter:

sdk: flutter

# The following adds the Cupertino Icons font to your application.

# Use with the CupertinoIcons class for iOS style icons.

cupertino_icons: ^0.1.3

flutter_screenutil: ^0.5.3

carousel_pro: ^0.0.13

flutter_sparkline: ^0.1.0

font_awesome_flutter: ^8.4.0

shimmer: ^0.0.6

rxdart: ^0.21.0

bmnav: ^0.3.4

carousel_slider: ^1.3.0

percent_indicator: ^1.0.15

flutter_spinkit: ^4.1.1+1

http: 0.12.0+4

shared_preferences: ^0.5.12+4

pin_code_fields: ^3.0.0

url_launcher: ^5.4.5

provider: ^4.0.1

clipboard_manager: ^0.0.4

aes_crypt: ^0.1.1

mvc_pattern: ^5.1.1

encrypt: any

majascan: ^0.3.7

flutter_launcher_icons: ^0.7.5

dev_dependencies:

flutter_test:

sdk: flutter

# For information on the generic Dart part of this file, see the

# following page: https://dart.dev/tools/pub/pubspec

flutter_icons:

image_path: "assets/image/logo.png"

ios: true

android: true

# The following section is specific to Flutter.

flutter:

# The following line ensures that the Material Icons font is

# included with your application, so that you can use the icons in

# the material Icons class.

uses-material-design: true

fonts:

- family: gainers

fonts:

- asset: assets/icon/ic_gainers.ttf

- family: message

fonts:

- asset: assets/icon/ic_message.ttf

- family: tab

fonts:

- asset: assets/icon/ic_tab.ttf

- family: wallet

fonts:

- asset: assets/icon/ic_wallet.ttf

- family: tab1

fonts:

- asset: assets/icon/ic_tab1.ttf

- family: tab2

fonts:

- asset: assets/icon/ic_tab2.ttf

- family: tab3

fonts:

- asset: assets/icon/ic_tab3.ttf

- family: tab4

fonts:

- asset: assets/icon/ic_tab4.ttf

- family: tab5

fonts:

- asset: assets/icon/ic_tab5.ttf

- family: loser

fonts:

- asset: assets/icon/ic_loser.ttf

- family: Sans

fonts:

- asset: assets/font/OpenSans-Bold.ttf

weight: 800

- asset: assets/font/OpenSans-Semibold.ttf

weight: 600

- asset: assets/font/OpenSans-Regular.ttf

weight: 400

- asset: assets/font/OpenSans-Light.ttf

weight: 200

- family : Popins

fonts:

- asset: assets/font/Poppins-Regular.ttf

weight: 400

- asset: assets/font/Poppins-SemiBold.ttf

weight : 600

- family : Berlin

fonts:

- asset: assets/font/BRLNSDB.TTF

weight: 700

- family : Lemon

fonts:

- asset: assets/font/Lemon-Regular.ttf

weight: 400

- family : Gotik

fonts:

- asset: assets/font/GOTHIC.TTF

weight: 400

- asset: assets/font/GOTHICB.TTF

weight : 600

- family : Pragmatica

fonts:

- asset: assets/font/pragmatica_bold.ttf

weight: 500

assets:

- assets/font/BRLNSDB.TTF

- assets/font/GOTHIC.TTF

- assets/font/GOTHICB.TTF

- assets/font/Lemon-Regular.ttf

- assets/font/OpenSans-Bold.ttf

- assets/font/OpenSans-Light.ttf

- assets/font/OpenSans-Regular.ttf

- assets/font/OpenSans-Semibold.ttf

- assets/font/Poppins-Regular.ttf

- assets/font/Poppins-SemiBold.ttf

- assets/font/pragmatica-bold.ttf

- assets/font/pragmatica.ttf

- assets/font/pragmatica_bold.ttf

- assets/icon/ic_gainers.ttf

- assets/icon/ic_loser.ttf

- assets/icon/ic_message.ttf

- assets/icon/ic_tab.ttf

- assets/icon/ic_tab1.ttf

- assets/icon/ic_tab2.ttf

- assets/icon/ic_tab3.ttf

- assets/icon/ic_tab4.ttf

- assets/icon/ic_tab5.ttf

- assets/icon/ic_wallet.ttf

- assets/image/

- assets/image/market/

- assets/image/logo.png

# To add assets to your application, add an assets section, like this:

# assets:

# - images/a_dot_burr.jpeg

# - images/a_dot_ham.jpeg

# An image asset can refer to one or more resolution-specific "variants", see

# https://flutter.dev/assets-and-images/#resolution-aware.

# For details regarding adding assets from package dependencies, see

# https://flutter.dev/assets-and-images/#from-packages

# To add custom fonts to your application, add a fonts section here,

# in this "flutter" section. Each entry in this list should have a

# "family" key with the font family name, and a "fonts" key with a

# list giving the asset and other descriptors for the font. For

# example:

# fonts:

# - family: Schyler

# fonts:

# - asset: fonts/Schyler-Regular.ttf

# - asset: fonts/Schyler-Italic.ttf

# style: italic

# - family: Trajan Pro

# fonts:

# - asset: fonts/TrajanPro.ttf

# - asset: fonts/TrajanPro_Bold.ttf

# weight: 700

#

# For details regarding fonts from package dependencies,

# see https://flutter.dev/custom-fonts/#from-packages

file 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

buildToolsVersion '28.0.3'

aaptOptions.cruncherEnabled = false

aaptOptions.useNewCruncher = false

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.flutter.app"

minSdkVersion 16

targetSdkVersion 28

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

}

}

}

flutter {

source '../..'

}

dependencies {

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

}

File android/build.gradle

buildscript {

ext.kotlin_version = '1.4.21'

repositories {

google()

jcenter()

}

dependencies {

classpath 'com.android.tools.build:gradle:3.6.1'

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

}

}

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

}

How can I fix this?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值