提问者:小点点

任务“:flutter_twitter:验证发布资源”的执行失败


我正在开发颤振应用程序。我可以在Android设备中成功运行应用程序,但尝试制作构建 (.apk) 文件并遇到以下问题。

FAILURE: Build failed with an exception.                                                                           

* What went wrong:                                                                                                 
Execution failed for task ':flutter_twitter:verifyReleaseResources'.                                               
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade                  
   > Android resource linking failed                                                                               
     /Users/ipatel/.gradle/caches/transforms-2/files-2.1/8f09fa5c6115de167b21b323f769edd9/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.

     /Users/ipatel/.gradle/caches/transforms-2/files-2.1/8f09fa5c6115de167b21b323f769edd9/core-1.0.0/res/values/values.xml:57:5-88: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 5m 2s                                                                                              
Running Gradle task 'assembleRelease'...                                                                           
Running Gradle task 'assembleRelease'... Done                     303.8s (!)
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 firebase_messaging...
The plugin firebase_messaging could not be built due to the issue above.

以下是项目的内容

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

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

> local.properties

sdk.dir=/Users/ipatel/Library/Android/sdk
flutter.sdk=/Users/ipatel/Documents/Amit/FlutterSetup/flutter
flutter.buildMode=release
flutter.versionName=1.0.0
flutter.ver

我的应用程序与AndroidX兼容,并且还尝试了许多解决方案,但无法解决我的问题。

我检查了 -
https://github.com/roughike/flutter_twitter_login/issues/29 -
执行 com.android.build.gradle.internal.tasks 时出现故障
- 颤振错误“Android 依赖项'androidx.core:core' 具有不同的版本”使用 flutter_local_notifications 和位置包

等。

颤振医生结果:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.12.13+hotfix.6, on Mac OS X 10.14.3 18D109, locale en-IN)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.41.1)
[✓] Connected device (4 available)

build.gradle

android {
    compileSdkVersion 28

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

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        applicationId "com.xxxx.aaaa"
        minSdkVersion 21
        targetSdkVersion 28
        multiDexEnabled true
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    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.debug
        }
    }
}

gradle.properties

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

~PS :如果您想从我这里获得更多详细信息,请告诉我。


共3个答案

匿名用户

问题是某些库不兼容或不使用androidx,而其他库则兼容。感谢谷歌将所有支持库转移到 androidx,现在许多库都有这样的冲突,我主要去调试哪个库有一个问题,比如从 pubspec 评论和取消评论库。

假设flutter_twitter插件是问题所在。

正如我们可以检查的那样,该推特插件不使用AndroidX链接,因此我们需要自己更改它。

(所有这些更改都需要在Twitter插件中进行更改,而不是Flutter Project)

我认为您可以将gradle.properties更改为使用androidx,也可以将版本编译为28 gradle.properties:

android.useAndroidX=true
android.enableJetifier=true

添加这两行,更改 gradle 类路径类路径 'com.android.tools.build:gradle:3.5.3' 并在 flutter_twitter 中编译 SdkVersion 28。我能够使用该插件生成发布版本。

哦,是的,您可以在/Users/parth.dave/.pub-cache/hosted/pub.dartlang.org/flutter_twitter_login-1.1.0/类似的地方找到缓存版本的插件,您可以在其中更新它。或者打开Androidstudio中的Android文件夹,工作室将显示两个项目应用程序和Twitter,您可以在其中更新此内容。

此外,有时最好在Android Studio中打开Android项目,并在运行Flutter项目之前更新所有可能出错的内容。

匿名用户

问题在于任务“:flutter_twitter:验证发布资源”的执行失败。 我找到了此问题的链接 flutter_twitter_login/问题 #12

在您的pubspec.yaml文件中添加此依赖项,让我知道这是否有效?

flutter_twitter_login: 
  git: git://github.com/eudangeld/flutter_twitter_login.git

匿名用户

转到左侧的Android Studio外部库

--