简体   繁体   English

无法确定 flutter 中任务 ':app:compileDebugJavaWithJavac' 的依赖关系

[英]Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' in flutter

Flutter was working perfectly on previous device. Flutter 在之前的设备上运行良好。 I have changed my laptop, after all the setup I am getting this error I am unable to understand this error.我已经更换了我的笔记本电脑,在所有设置之后我收到此错误我无法理解此错误。

  1. please explain what is this error for.请解释这是什么错误。

  2. Solution for this error此错误的解决方案

I am just running very basic application.我只是在运行非常基本的应用程序。

app 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) {
>     throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") }
> 
> def flutterVersionCode =
> localProperties.getProperty('flutter.versionCode') if
> (flutterVersionCode == null) {
>     flutterVersionCode = '1' }
> 
> def flutterVersionName =
> localProperties.getProperty('flutter.versionName') if
> (flutterVersionName == null) {
>     flutterVersionName = '1.0' }
> 
> apply plugin: 'com.android.application' apply plugin: 'kotlin-android'
> apply from:
> "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
> 
> android {
>     compileSdkVersion 29
> 
>     sourceSets {
>         main.java.srcDirs += 'src/main/kotlin'
>     }
> 
>     lintOptions {
>         disable 'InvalidPackage'
>     }
> 
>     defaultConfig {
>         // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
>         applicationId "com.example.flutter_app"
>         minSdkVersion 16
>         targetSdkVersion 29
>         versionCode flutterVersionCode.toInteger()
>         versionName flutterVersionName
>     }
> 
>     buildTypes {
>         release {
>             // TODO: Add your own signing config for the release build.
>             // Signing with the debug keys for now, so `flutter run --release` works.
>             signingConfig signingConfigs.debug
>         }
>     } }
> 
> flutter {
>     source '../..' }
> 
> dependencies {
>     implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" }

android gradle

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Logcat: Please configure Android SDK Logcat:请配置Android SDK

Terminal report终端报告

 C:\Users\HP\StudioProjects\flutter_app>flutter run
    Using hardware rendering with device sdk gphone x86. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
    Launching lib\main.dart on sdk gphone x86 in debug mode...
    Checking the license for package Android SDK Build-Tools 28.0.3 in C:\Users\HP\AppData\Local\Android\sdk\licenses
    Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
    Checking the license for package Android SDK Platform 29 in C:\Users\HP\AppData\Local\Android\sdk\licenses
    Warning: License for package Android SDK Platform 29 not accepted.
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
    > Failed to install the following Android SDK packages as some licences have not been accepted.
         build-tools;28.0.3 Android SDK Build-Tools 28.0.3
         platforms;android-29 Android SDK Platform 29
      To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
      Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
    
      Using Android SDK: C:\Users\HP\AppData\Local\Android\sdk
    
    * 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 1s
    Running Gradle task 'assembleDebug'...
    Running Gradle task 'assembleDebug'... Done                         2.5s
    Exception: Gradle task assembleDebug failed with exit code 1

Flutter doctor - V颤振医生-V

[√] Flutter (Channel stable, 1.22.0, on Microsoft Windows [Version 10.0.18362.1082], locale en-US)
    • Flutter version 1.22.0 at C:\src\flutter
    • Framework revision d408d302e2 (4 days ago), 2020-09-29 11:49:17 -0700
    • Engine revision 5babba6c4d
    • Dart version 2.10.0


[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at C:\Users\HP\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[√] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 50.0.1
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.49.2)
    • VS Code at C:\Users\HP\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.14.1

[√] Connected device (1 available)
    • sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)

! Doctor found issues in 1 category.

Run this command to accept all license from Android.运行此命令以接受来自 Android 的所有许可。 flutter doctor --android-licenses and download sdk manager and build tools from Android studio flutter doctor --android-licenses并从 Android Studio 下载 sdk 管理器和构建工具

Apparently, what you can do is simply head to your Android SDK directory and显然,您可以做的只是前往您的 Android SDK 目录并

cd "/tools/bin"

and run the following command并运行以下命令

 sdkmanager --licenses

and let the terminal do its job !让终端完成它的工作!

Here is the main problem这是主要问题

Failed to install the following Android SDK packages as some licenses have not been accepted.由于某些许可未被接受,因此无法安装以下 Android SDK 包。 build-tools;28.0.3 Android SDK Build-Tools 28.0.3 platforms;android-29 Android SDK Platform 29 build-tools;28.0.3 Android SDK Build-Tools 28.0.3 平台;android-29 Android SDK 平台 29

As the error suggests, first accept all licenses by running the following command如错误所示,首先通过运行以下命令接受所有许可证

flutter doctor --android-licenses颤振医生 --android-licenses

next head over to https://androidsdkmanager.azurewebsites.net/Buildtools and download the build tool that corresponds to the one you are missing in this case 28.0.3 After downloading extract the zip file into C:\\Android\\Sdk\\build-tools\\28.0.3 if you are on windows and /Library/Android/sdk/build-tools/28.0.3 if you are on mac接下来转到https://androidsdkmanager.azurewebsites.net/Buildtools并下载与您在这种情况下缺少的构建工具相对应的构建工具 28.0.3 下载后将 zip 文件解压缩到C:\\Android\\Sdk\\build- tools\\28.0.3如果你在 windows 上, / Library/Android/sdk/build-tools/28.0.3如果你在 mac 上

finally, download the missing Android SDK platform 29 from https://androidsdkmanager.azurewebsites.net/SDKPlatform and unzip it into /Library/Android/sdk/platforms/android-29 if you are on mac or C:\\Android\\Sdk\\platforms\\android-29 if you are on windows最后,从https://androidsdkmanager.azurewebsites.net/SDKPlatform下载缺少的 Android SDK 平台 29 并将其解压缩到/Library/Android/sdk/platforms/android-29(如果您使用的是 mac 或C:\\Android\\Sdk\\)平台\\android-29如果你在 Windows 上

Run your project (flutter run) and enjoy运行你的项目(flutter run)并享受

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法确定任务 ':app:compileDebugJavaWithJavac' 的依赖关系 - Flutter - Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' - Flutter 无法确定任务 ':app:compileDebugJavaWithJavac' 的依赖关系。 颤振应用 - Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. flutter application 无法确定任务 ':app:compileDebugJavaWithJavac' 的依赖关系。 flutter 上的问题 - Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. problem on flutter 无法确定任务 ':app:compileDebugJavaWithJavac' 的依赖关系。 (一个信号) - Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. (OneSignal) 错误=>无法确定任务':app:compileDebugJavaWithJavac'的依赖关系 - Error=> Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' flutter 无法确定依赖项 ':app:compileDebugJavaWithJavac' - flutter Could not determine the dependencies ':app:compileDebugJavaWithJavac' 在 vscode 中运行 flutter 应用程序并收到此错误无法确定任务':app:compileDebugJavaWithJavac'的依赖关系 - Running flutter app in vscode and get this error Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' 如何解决无法确定任务':app:compileDebugJavaWithJavac'的依赖关系 - Android - How to solve Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' - Android 无法确定 android 工作室中任务“:app:compileDebugJavaWithJavac”的依赖关系 - Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' in android studio 错误:无法确定任务':app:crashlyticsStoreDeobsDebug'的依赖关系 - Error:Could not determine the dependencies of task ':app:crashlyticsStoreDeobsDebug'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM