亚欧色一区w666天堂,色情一区二区三区免费看,少妇特黄A片一区二区三区,亚洲人成网站999久久久综合,国产av熟女一区二区三区

  • 發布文章
  • 消息中心
點贊
收藏
評論
分享
原創

Flutter開發中androidX編譯與運行時不同版本的問題

2023-02-16 09:46:12
78
0

我之前做flutter開發視頻拍攝軟件的時候遇到過一個androidX編譯與運行時不同版本的問題,現在將當時的場景復原,以供大家參考。

引入 image_picker,以實現從手機系統選取視頻的功能。安卓端依次報錯:

  • What went wrong:
    Execution failed for task ‘:app:preDebugBuild’.

Android dependency ‘androidx.core:core’ has different version for the compile (1.0.0) and runtime (1.1.0-alpha04) classpath. You should manually set the same version via DependencyResolution

  • 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 //help.gradle.org

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:preDebugBuild’.

    Android dependency ‘androidx.fragment:fragment’ has different version for the compile (1.0.0) and runtime (1.1.0-alpha04) classpath. You should manually set the same version via DependencyResolution

  • 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 //help.gradle.org

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:preDebugBuild’.

    Android dependency ‘androidx.lifecycle:lifecycle-viewmodel’ has different version for the compile (2.0.0) and runtime (2.1.0-alpha02) classpath. You should manually set the same version via DependencyResolution

  • 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 //help.gradle.org

sf、flutter issue給出的解決方案有:

//stackoverflow.com/questions/54823084/flutter-error-android-dependency-androidx-corecore-has-different-version-us

//github.com/flutter/flutter/issues/27254

//github.com/Sh1d0w/multi_image_picker/issues/78

//stackoverflow.com/questions/44653261/android-dependency-has-different-version-for-the-compile-and-runtime

給出的思路大體是:

  • 部分插件未升級androidX、部分已升級androidX,此時需全部升級。pass,我的全是androidX
  • 發現版本不一致的依賴,強制使用其中之一。pass,沒用

最后,我的解決方案是:

androidx.legacy 依賴由 api換為 implementation。因為api定義的模塊依賴是可以被其他模塊使用的,而implementation定義的依賴只能在模塊內部使用,這樣就避免了沖突。

1
2
3
dependencies {
 implementation 'androidx.legacy:legacy-support-v4:1.0.0'
}

分隔線


補充image_picker幾個問題

image_picker同其他插件一樣,凡是涉及平臺通道的,在兩個系統里表現都很難做到完全一致。

  • IOS端,image_picker獲取的文件帶file://頭部,android端沒有,所以拿到文件地址后,如果要創建新的File對象,需要去掉該頭部。
  • IOS端,因為權限問題,無法獲取應用外部文件的信息。所以需要將文件拷貝至應用內部,再操作。
0條評論
0 / 1000
張****亮
9文章數
0粉絲數
張****亮
9 文章 | 0 粉絲
原創

Flutter開發中androidX編譯與運行時不同版本的問題

2023-02-16 09:46:12
78
0

我之前做flutter開發視頻拍攝軟件的時候遇到過一個androidX編譯與運行時不同版本的問題,現在將當時的場景復原,以供大家參考。

引入 image_picker,以實現從手機系統選取視頻的功能。安卓端依次報錯:

  • What went wrong:
    Execution failed for task ‘:app:preDebugBuild’.

Android dependency ‘androidx.core:core’ has different version for the compile (1.0.0) and runtime (1.1.0-alpha04) classpath. You should manually set the same version via DependencyResolution

  • 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 //help.gradle.org

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:preDebugBuild’.

    Android dependency ‘androidx.fragment:fragment’ has different version for the compile (1.0.0) and runtime (1.1.0-alpha04) classpath. You should manually set the same version via DependencyResolution

  • 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 //help.gradle.org

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:preDebugBuild’.

    Android dependency ‘androidx.lifecycle:lifecycle-viewmodel’ has different version for the compile (2.0.0) and runtime (2.1.0-alpha02) classpath. You should manually set the same version via DependencyResolution

  • 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 //help.gradle.org

sf、flutter issue給出的解決方案有:

//stackoverflow.com/questions/54823084/flutter-error-android-dependency-androidx-corecore-has-different-version-us

//github.com/flutter/flutter/issues/27254

//github.com/Sh1d0w/multi_image_picker/issues/78

//stackoverflow.com/questions/44653261/android-dependency-has-different-version-for-the-compile-and-runtime

給出的思路大體是:

  • 部分插件未升級androidX、部分已升級androidX,此時需全部升級。pass,我的全是androidX
  • 發現版本不一致的依賴,強制使用其中之一。pass,沒用

最后,我的解決方案是:

androidx.legacy 依賴由 api換為 implementation。因為api定義的模塊依賴是可以被其他模塊使用的,而implementation定義的依賴只能在模塊內部使用,這樣就避免了沖突。

1
2
3
dependencies {
 implementation 'androidx.legacy:legacy-support-v4:1.0.0'
}

分隔線


補充image_picker幾個問題

image_picker同其他插件一樣,凡是涉及平臺通道的,在兩個系統里表現都很難做到完全一致。

  • IOS端,image_picker獲取的文件帶file://頭部,android端沒有,所以拿到文件地址后,如果要創建新的File對象,需要去掉該頭部。
  • IOS端,因為權限問題,無法獲取應用外部文件的信息。所以需要將文件拷貝至應用內部,再操作。
文章來自個人專欄
文章 | 訂閱
0條評論
0 / 1000
請輸入你的評論
0
0