无法在 Intellij 中运行 Android Studio:java.lang.AssertionError:Bazel 路径仅存在于 AndroidStudio 开发模式中

发布于 2025-01-12 01:05:45 字数 3900 浏览 1 评论 0原文

我想运行 2 个应用程序,其中一个在我的 PC 上使用 javaFX,另一个在我的 Android 手机上,通过 USB 连接传输对象。我可以从独立的 Android Studio 程序运行基本的应用程序模板,但是当我尝试使用 Intellij 中的 Android Studio 插件执行相同操作时,我收到此错误:

Can't download Android Plugin component: android-plugin-resources: Check logs for details

我尝试删除并重新安装 Android SDK,尝试了不同的 SDK 版本,通过命令行工具下载 Android Studio SDK FZ,按照各种教程在 Intellij 中设置 Android Studio,但无济于事。

如果我无法让它发挥作用,还有其他方法吗?是否可以在同一模块/解决方案中运行独立的 Android Studio 和 Intellij,并在每个项目之间调用函数?

build.gradle代码:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 32
    buildToolsVersion "32.0.0"

    defaultConfig { 
        applicationId "com.example.myapp"
        minSdkVersion 29
        targetSdkVersion 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.1.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

}
 

日志详细信息:

java.lang.AssertionError:Bazel路径仅存在于AndroidStudio开发模式中 在com.android.tools.idea.gradle.util.EmbeddedDistributionPaths.findEmbeddedInstaller(EmbeddedDistributionPaths.java:133) 在 com.android.tools.idea.run.AndroidLaunchTasksProvider.lambda$getDeployTasks$0(AndroidLaunchTasksProvider.java:184) 在 com.android.tools.idea.run.tasks.AbstractDeployTask.getLocalInstaller(AbstractDeployTask.java:147) 在com.android.tools.idea.run.tasks.AbstractDeployTask.run(AbstractDeployTask.java:103) 在com.android.tools.idea.run.LaunchTaskRunner.run(LaunchTaskRunner.java:190) 在 com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:962) 在 com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:472) 在 com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:235) 在 com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:178) 在 com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:658) 在com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:610) 在 com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:65) 在 com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:165) 在 com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:235) 在 java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700) 在 java.base/java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128) 在 java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 在 java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668) 在 java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665) 在 java.base/java.security.AccessController.doPrivileged(本机方法) 在 java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665) 在 java.base/java.lang.Thread.run(Thread.java:834)

I want to run 2 applications, 1 on my PC using javaFX and another on my Android phone, to transfer objects via a USB connection. I can run a basic app template from the standalone Android Studio program just fine, but when I try to do the same using the Android Studio plugin inside Intellij, I get this error:

Can't download Android Plugin component: android-plugin-resources: Check logs for details

I have tried deleting and reinstalling Android SDK, tried different SDK versions, download Android Studio SDK FZvia Commandline tools, followed various turtorials for setting up Android Studio inside Intellij but to no avail.

Is there another approach if I can't get this to work? Is it possible to run the standalone Android Studio and Intellij in the same module/solution, and call functions between each project?

build.gradle code:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 32
    buildToolsVersion "32.0.0"

    defaultConfig { 
        applicationId "com.example.myapp"
        minSdkVersion 29
        targetSdkVersion 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.1.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

}
 

Log details:

java.lang.AssertionError: Bazel paths exist only in AndroidStudio development mode
at com.android.tools.idea.gradle.util.EmbeddedDistributionPaths.findEmbeddedInstaller(EmbeddedDistributionPaths.java:133)
at com.android.tools.idea.run.AndroidLaunchTasksProvider.lambda$getDeployTasks$0(AndroidLaunchTasksProvider.java:184)
at com.android.tools.idea.run.tasks.AbstractDeployTask.getLocalInstaller(AbstractDeployTask.java:147)
at com.android.tools.idea.run.tasks.AbstractDeployTask.run(AbstractDeployTask.java:103)
at com.android.tools.idea.run.LaunchTaskRunner.run(LaunchTaskRunner.java:190)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:962)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:472)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:235)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:178)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:658)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:610)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:65)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:165)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:235)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:834)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时间海 2025-01-19 01:05:45

解决方案: 只需将 Intellij 更新到最新版本,结果发现问题是每次我的程序运行时 Intellij 都尝试下载插件,但它尝试访问的链接不再有效。通过将安装的intellij版本2020.3.2更新到最新版本,问题得到解决。

Solution: Just update Intellij to the newest version, turns out the problem was that Intellij was attempting to download a plugin every time my program is run, but the link it's trying to access no longer works. By updating the installed intellij version 2020.3.2 to the newest version , the issue is fixed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文