1

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

Afterglow
  • 345
  • 4
  • 12

2 Answers2

2

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.

https://stackoverflow.com/a/65955788/15486462

Afterglow
  • 345
  • 4
  • 12
0

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 
Aslm Monir
  • 51
  • 3