英文:
Could not compile my app in release mode due to `AAPT: error: resource android:attr/lStar not found.`
问题
I can compile and run in debug mode, no problem.
But when I want to compile to release or profile mode I get:
>Execution failed for task ':cached_video_player:verifyReleaseResources'.
The reported issue is:
AAPT: error: resource android:attr/lStar not found.
Doing an build app bundle
works though which I can't get it:
stephanedeluca@Angelantonio2019-2:~/development/shokaze/shokaze/functions$ flutter build appbundle
Changing current working directory to: /Users/stephanedeluca/development/shokaze/shokaze
Font asset "CupertinoIcons.ttf" was tree-shaken, reducing it from 283452 to 912 bytes (99.7% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 16824 bytes (99.0% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Running Gradle task 'bundleRelease'... 180,1s
✓ Built build/app/outputs/bundle/release/app-release.aab (68.3MB).
Anyone knows how to fix this?
Following are my attempts so far.
I've upgraded cached_video_player
to 2.0.4 from 2.0.3 before but get the same issue.
cached_video_player: ^2.0.4 #^2.0.3
I also upgraded (android/build.gradle
) my `kotlin_version to 1.9 (I was 1.8.22 before):
buildscript {
ext.kotlin_version = '1.9.0' //'1.8.22'//'1.6.10'
repositories {
Finally, I also tried adding this line as suggested in the https://stackoverflow.com/questions/69021225/resource-linking-fails-on-lstar/69029908#69029908 SO answers:
implementation "androidx.core:core-ktx:1.6.0"
But it did not fix the issue.
Here is the whole gradle
trace is as follows:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':cached_video_player:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
> Android resource linking failed
ERROR:/Users/stephanedeluca/.gradle/caches/transforms-3/fb7be7b58c0779ade2219e6b1355257d/transformed/core-1.7.0/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar 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 34s
Exception: Gradle task assembleRelease failed with exit code 1
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 AndroidGradleBuilder.buildGradleApp (package:flutter_tools/src/android/gradle.dart:456:9)
<asynchronous suspension>
#2 AndroidGradleBuilder.buildApk (package:flutter_tools/src/android/gradle.dart:208:5)
<asynchronous suspension>
#3 AndroidDevice.startApp (package:flutter_tools/src/android/android_device.dart:578:7)
<asynchronous suspension>
#4 FlutterDevice.runCold (package:flutter_tools/src/resident_runner.dart:524:33)
<asynchronous suspension>
#5 ColdRunner.run (package:flutter_tools/src/run_cold.dart:57:28)
<asynchronous suspension>
#6 AppDomain.launch.<anonymous closure> (package:flutter_tools/src/commands/daemon.dart:648:9)
<asynchronous suspension>
#7 AppDomain.launch (package:flutter_tools/src/commands/daemon.dart:646:5)
<asynchronous suspension>
#8 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:638:15)
<asynchronous suspension>
#9 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1336:27)
<asynchronous suspension>
#10 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#11 CommandRunner.runCommand
command_runner.dart:212
<asynchronous suspension>
#12 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:296:9)
<asynchronous suspension>
#13 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#14 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:244:5)
<asynchronous suspension>
#15 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:91:9)
<asynchronous suspension>
#16 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#17 main (package:flutter_tools/executable.dart:91:3)
<asynchronous suspension>
And my android/app/build.gradle
is as follows:
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 a 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'
// START: FlutterFire Configuration
apply plugin: 'com.google.gms.google-services'
// END
<details>
<summary>英文:</summary>
I can compile and run in debug mode, no problem.
But when I want to compile to release or profile mode I get:
>Execution failed for task ':cached_video_player:verifyReleaseResources'.
The reported issue is:
`AAPT: error: resource android:attr/lStar not found.`
Doing an `build app bundle` works though which I can't get it:
stephanedeluca@Angelantonio2019-2:~/development/shokaze/shokaze/functions$ flutter build appbundle
Changing current working directory to: /Users/stephanedeluca/development/shokaze/shokaze
Font asset "CupertinoIcons.ttf" was tree-shaken, reducing it from 283452 to 912 bytes (99.7% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 16824 bytes (99.0% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Running Gradle task 'bundleRelease'... 180,1s
✓ Built build/app/outputs/bundle/release/app-release.aab (68.3MB).
Anyone knows how to fix this?
Following are my attempts so far.
I've upgraded `cached_video_player` to 2.0.4 from 2.0.3 before but get the same issue.
cached_video_player: ^2.0.4 #^2.0.3
I also upgraded (`android/build.gradle`) my `kotlin_version to 1.9 (I was 1.8.22 before):
buildscript {
ext.kotlin_version = '1.9.0' //'1.8.22'//'1.6.10'
repositories {
Fnally, I also tried adding this line as suggested in the https://stackoverflow.com/questions/69021225/resource-linking-fails-on-lstar/69029908#69029908 SO answers:
implementation "androidx.core:core-ktx:1.6.0"
But it did not fix the issue.
Here is the whole `gradle` trace is as follows:
FAILURE: Build failed with an exception.
-
What went wrong:
Execution failed for task ':cached_video_player:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
> Android resource linking failed
ERROR:/Users/stephanedeluca/.gradle/caches/transforms-3/fb7be7b58c0779ade2219e6b1355257d/transformed/core-1.7.0/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar 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 34s
Exception: Gradle task assembleRelease failed with exit code 1
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 AndroidGradleBuilder.buildGradleApp (package:flutter_tools/src/android/gradle.dart:456:9)
<asynchronous suspension>
#2 AndroidGradleBuilder.buildApk (package:flutter_tools/src/android/gradle.dart:208:5)
<asynchronous suspension>
#3 AndroidDevice.startApp (package:flutter_tools/src/android/android_device.dart:578:7)
<asynchronous suspension>
#4 FlutterDevice.runCold (package:flutter_tools/src/resident_runner.dart:524:33)
<asynchronous suspension>
#5 ColdRunner.run (package:flutter_tools/src/run_cold.dart:57:28)
<asynchronous suspension>
#6 AppDomain.launch.<anonymous closure> (package:flutter_tools/src/commands/daemon.dart:648:9)
<asynchronous suspension>
#7 AppDomain.launch (package:flutter_tools/src/commands/daemon.dart:646:5)
<asynchronous suspension>
#8 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:638:15)
<asynchronous suspension>
#9 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1336:27)
<asynchronous suspension>
#10 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#11 CommandRunner.runCommand
command_runner.dart:212
<asynchronous suspension>
#12 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:296:9)
<asynchronous suspension>
#13 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#14 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:244:5)
<asynchronous suspension>
#15 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:91:9)
<asynchronous suspension>
#16 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#17 main (package:flutter_tools/executable.dart:91:3)
<asynchronous suspension>
And my `android/app/build.gradle` is as follows:
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'
// START: FlutterFire Configuration
apply plugin: 'com.google.gms.google-services'
// END: FlutterFire Configuration
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 33
//flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
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.shokaze.shokaze"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 24
//flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
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 {
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// Sdl on Sunday July 23th 2023 see https://stackoverflow.com/questions/69021225/resource-linking-fails-on-lstar/69029908#69029908
//implementation "androidx.core:core-ktx:1.6.0"
def billing_version = "5.1.0" // for today, it's the latest
implementation "com.android.billingclient:billing:$billing_version"
}
</details>
# 答案1
**得分**: 1
似乎是包本身的Gradle版本问题,请尝试在您的`pubspec.yaml`中的依赖项中添加以下内容:
```yml
cached_video_player:
git:
url: https://github.com/vikram25897/flutter_cached_video_player
ref: feature/gradle_version_bump
英文:
Seems like a gradle version issue from the package itself, try adding the below for the dependency in your pubspec.yaml
:
cached_video_player:
git:
url: https://github.com/vikram25897/flutter_cached_video_player
ref: feature/gradle_version_bump
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论