问题描述
在运行控制台期间,image_picker_saver软件包使AndroidX不兼容.包裹是-image_picker_saver:^ 0.1.0
During the run console, the image_picker_saver package is giving AndroidX incompability.the package is - image_picker_saver: ^0.1.0
任何人都可以帮助解决该错误吗?
Can anyone help how to handle this error?
运行控制台-
^
symbol: variable ActivityCompat
C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker_saver-0.1.0\android\src\main\java\io\flutter\plugins\imagepickersaver\ImagePickerDelegate.java:139: error: cannot find symbol
ActivityCompat.requestPermissions(activity, new String[]{permissionName}, requestCode);
^
symbol: variable ActivityCompat
C:\flutter\.pub-cache\hosted\pub.dartlang.org\image_picker_saver-0.1.0\android\src\main\java\io\flutter\plugins\imagepickersaver\ImagePickerDelegate.java:151: error: cannot find symbol
return FileProvider.getUriForFile(activity, fileProviderName, file);
^
symbol: variable FileProvider
20 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':image_picker_saver:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 36s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
推荐答案
我建议您启用AndroidX.
I suggest you to enable AndroidX.
官方文档: https://flutter.dev/docs/开发/packages-and-plugins/androidx-compatibility
如您在第三项中所看到的:
As you see in third entry:
在android/gradle.properties中,附加=>
In android/gradle.properties, append =>
android.enableJetifier=true
android.useAndroidX=true
如果您不想使用AndroidX,则可以使用下面列出的最新版本的软件包.
If you don't want to use AndroidX, latest version of packages you can use listed down below.
如果您的软件包未在此处列出,则只能选择启用AndroidX.
If your package don't listed there, enabling AndroidX is only choice.
还可以更改android/app/gradle.build中的最小sdk:
Also change your minimum sdk inside android/app/gradle.build:
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.flutter_testing"
minSdkVersion 16 // => Make this 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
最后,请遵循该答案:
如何修复任务':app:processDebugResources'的执行失败. > Android资源链接失败" [[Android/Flutter]
也更改gradle版本.
Change the gradle version also.
这篇关于针对image_picker_saver的AndroidX不兼容错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!