我曾经有这个sqflite在我的pubspec. yaml文件,但最近我删除了依赖看到我不会利用它,然后我在我的Android设备和模拟器上运行应用程序,我得到了一个奇怪的错误,并在谷歌上搜索解决方案,似乎我找不到任何帮助,以及检查堆栈溢出.
- 到目前为止已完成的工作:**
1.作为一个经验法则,我运行flutter clean
,看看问题是否会得到解决,但它也没有工作
1.使Android Studio失效并重新启动
- 这是我遇到的错误**
Launching lib/main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
/Users/zionnite/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-2.0.0+3/android/src/main/java/com/tekartik/sqflite/SqflitePlugin.java:910: error: cannot find symbol
database.deleteDatabase(path);
^
symbol: variable database
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':sqflite: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 58s
Exception: Gradle task assembleDebug failed with exit code 1
- 相关性**
# sqflite: ^2.0.0+3
# path_provider: ^2.0.1
此时,即使我启用了依赖关系,问题仍然存在。
然而,除了android设备和模拟器,我的ios模拟器上一切都很好
2条答案
按热度按时间cbjzeqam1#
我能够与死亡的敌人战斗,为我的代码的进步而战,并通过
flutter pub cache repair
的神奇触摸获得胜利。我的意思是,当我运行
flutter pub cache repair
时,Flutter能够在我的Android设备和模拟器上构建和运行rbpvctlc2#
该问题由Java版本8引起。因此您应该使用Java版本11。
最后,清理和重建,就这样.