这是我导入shared_preferences插件并尝试构建项目时的控制台输出。
http://example.com/suburl0
http://example.com/suburl1
http://example.com/suburl2
http://example.com/suburl3
http://example.com/suburl4
我的Android Studio Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
D:\Program File\sdk\flutter\flutter_windows_v1.9.1+hotfix.2-stable\.pub-cache\hosted\pub.dartlang.org\shared_preferences-0.5.4+6\android\src\main\java\io\flutter\plugins\sharedpreferences\SharedPreferencesPlugin.java:25: ����: ������LifecycleOwner
setupChannel(binding.getFlutterEngine().getDartExecutor(), binding.getApplicationContext());
^
�Ҳ���android.arch.lifecycle.LifecycleOwner�����ļ�
1 ������
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':shared_preferences:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
设置为 UTF-8 ,而我的系统默认收入为 GBK 。
这是我的File Encoding
输出:
flutter doctor -v
但是,如果我将[√] Flutter (Channel unknown, v1.10.14, on Microsoft Windows [Version 10.0.17763.107], locale zh-CN)
• Flutter version 1.10.14 at D:\Program File\sdk\flutter\flutter_windows_v1.9.1+hotfix.2-stable
• Framework revision 1946fc4da0 (7 weeks ago), 2019-10-07 15:23:31 -0700
• Engine revision 1d62160fdb
• Dart version 2.6.0 (build 2.6.0-dev.5.0 d6c6d12ebf)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: D:\Program File\as\bin\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Android Studio (version 3.4)
• Android Studio at D:\Program File\as\bin
• Flutter plugin version 39.0.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[!] VS Code, 64-bit edition (version 1.32.3)
• VS Code at C:\Program Files\Microsoft VS Code
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
! No devices available
更改为shared_preferences: ^0.5.4+6
,就可以正常工作…………所以,构建失败的原因可能是由于
shared_preferences: 0.5.3+5
和Androidx
冲突。
但是如何解决控制台乱码的问题?