每当尝试运行 flutter 应用程序时,我都会遇到此错误。
* What went wrong:
Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
java.nio.file.FileSystemException: D:\Projects\buisnesscard\build\app\intermediates\transforms\mergeJavaRes\debug\0.jar: The process cannot access the file because it is being used by another process.
我尝试添加:
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
}
到我的构建 gradle 文件并重新启动 android studio 但错误仍然发生。
我的 /app/build.gradle 看起来像这样:
`
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) { …Run Code Online (Sandbox Code Playgroud) 尝试将Google Maps API添加到Flutter时,在日志中出现以下错误:
/MethodChannel#flutter/platform_views(11205): java.lang.RuntimeException: API key not found. Check that <meta-data android:name="com.google.android.geo.API_KEY" android:value="your API key"/> is in the <application> element of AndroidManifest.xml
Run Code Online (Sandbox Code Playgroud)
我的AndroidManifest.xml文件如下所示:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.foody.foody">
<!-- The INTERNET permission is required for development. Specifically,
flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if …Run Code Online (Sandbox Code Playgroud)