英文:
IDEA does not always deploy latest changes
问题
settings.gradle.kts
我尝试在一个文件夹中同时运行Android应用和Compose for Desktop应用,但遇到了一些问题。
MyProject
│ │└──android
│ │ │ └── app
│ │ │ └──build.gradle.kts
│ │ └── build.gradle.kts
│ └── desktop
│ └── build.gradle.kts
└── settings.gradle.kts
**settings.gradle.kts**
pluginManagement {
repositories {
google()
gradlePluginPortal()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
plugins {
kotlin("multiplatform").version("1.7.10")
id("org.jetbrains.compose").version("1.2.0")
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "MyProject"
include("android:app")
include("desktop")
我的Android应用采用单模块架构,但当我在IDEA中运行 `android.app` 时,它会尝试**直接**安装APK到模拟器/手机上,而不经过构建阶段。如果我删除构建文件夹中的 app-debug.apk 并再次运行它,它将无法安装APK。
IDEA: IntelliJ IDEA 2022.3.2 (Ultimate Edition)
AGP: 7.3.0
gradle: 7.5.1
02/06: Launching 'android.app' on <default>.
Error loading build artifacts from: C:\Users\...\android\app\build\intermediates\apk_ide_redirect_file\debug\redirect.txt
就像上面的错误一样,IDEA似乎一直在尝试安装缓存的APK,而不是构建最新的APK。
英文:
I tried to run both the android app and the compose for desktop app in one folder, but I ran into some problems.
MyProject
│ │└──android
│ │ │ └── app
│ │ │ └──build.gradle.kts
│ │ └── build.gradle.kts
│ └── desktop
│ └── build.gradle.kts
└── settings.gradle.kts
settings.gradle.kts
pluginManagement {
repositories {
google()
gradlePluginPortal()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
plugins {
kotlin("multiplatform").version("1.7.10")
id("org.jetbrains.compose").version("1.2.0")
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "MyProject"
include("android:app")
include("desktop")
My Android app has a single module architecture, but when I run android.app
in IDEA, it tries to install the apk directly on my emulator/phone without going through the building stage. If I delete the app-debug.apk in the build folder and run it again, it will not be able to install the apk.
IDEA: IntelliJ IDEA 2022.3.2 (Ultimate Edition)
AGP: 7.3.0
gradle: 7.5.1
02/06: Launching 'android.app' on <default>.
Error loading build artifacts from: C:\Users\...\android\app\build\intermediates\apk_ide_redirect_file\debug\redirect.txt
Just like the error above, IDEA seems to be forever trying to install the cached apk instead of building the latest apk
答案1
得分: 2
这个答案对我有用,但我仍然不明白为什么当我从单模块Gradle项目切换到多模块Gradle项目时会出现这个问题。
https://stackoverflow.com/a/65955788/15486462
英文:
This answer worked for me, but I still don't understand why I have this problem when I change from a single-module gradle project to a multi-module gradle project.
答案2
得分: 0
以下是翻译好的部分:
创建一个新的运行配置,参数与默认的配置应用相同:
运行 &&
编辑配置 &&
添加新配置 &&
重命名 &&
选择应用模块 &&
应用 &&
从 Android Studio 的运行按钮正常运行应用
英文:
what worked for me is this :
Create a new configuration for Run with the same parameters as the default config app
Run &&
Edit Configuration &&
Add New Configuration &&
Rename &&
Choose app Module &&
Apply &&
Run app normally from Run Button android studio
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论