由于主机项目使用与v4不兼容的androidx库,因此无法通过编程方式获取抖动片段

时间:2020-02-09 09:43:55

标签: flutter androidx

FlutterFragment出现了一个问题,该问题从android.support.v4.app.Fragment支持库扩展到了而不是androidx

因此,由于宿主项目使用的是与v4不兼容的androidx库,因此我无法以编程方式获取Flutter片段。

这些是我对主机和flutter模块的设置:

-gradle.properties(宿主项目)

android.enableJetifier=true
android.useAndroidX=true

-settings.gradle (宿主项目)

evaluate(new File(
        settingsDir.parentFile,
        '/flutterlib/.android/include_flutter.groovy'
))

-build.gradle (应用模块)

implementation project(':flutter')

-pubspec.yaml (颤动项目)

 module:
    androidX: true
    androidPackage: com.example.project_flutter
    iosBundleIdentifier: com.example.project_flutter

-.android / gradle.properties

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

-.android / Flutter / build.gradle (试图添加androidx.legacy / annotation库)

dependencies {
    testImplementation 'junit:junit:4.12'
    implementation 'androidx.legacy:legacy-support-v13:1.0.0'
    implementation 'androidx.annotation:annotation:1.0.0'
}

我已经检查了所有上述内容,但FlutterFragment仍从v4支持库继续扩展。

另外,我检查了FlutterFragment.java.tmpl,我认为框架应该从该框架生成v4或androidx FlutterFragment类,并且确实包含正确的条件

{{#androidX}}
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
{{/androidX}}
{{^androidX}}
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
{{/androidX}}

我在做什么错? 非常感谢对此的任何投入。

- This is my flutter doctor -v output:
[✓] Flutter (Channel stable, v1.12.13+hotfix.7, on Mac OS X 10.15.2 19C57, locale en-IL)
    • Flutter version 1.12.13+hotfix.7 at /Users/user/Projects/flutter
    • Framework revision 9f5ff2306b (13 days ago), 2020-01-26 22:38:26 -0800
    • Engine revision a67792536c
    • Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/user/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C504
    • CocoaPods version 1.8.4
[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 43.0.2
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.1)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 43.0.2
    • Dart plugin version 191.6183.88
[✓] VS Code (version 1.42.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.8.1
[✓] Connected device (1 available)
    • SM G950F • 988a1b47315139564e • android-arm64 • Android 9 (API 28)
• No issues found!

0 个答案:

没有答案