I have Android Studio 3.4 and have cloned a github respository of a Kotlin-based app (Voice). The subject of this question probably would find equivalence in other repositories as well.
The cloning, done from Android Studio, recognizes the Gradle build information in the repository and when prompted, I took the defaults associated with loading the project into the IDE.
You have checked out an Android Studio project file: C:\Users\Owner\AndroidStudioProjects\VoiceC\build.gradle.kts Would you like to open it?
Group modules:
using qualified names
Use default gradle wrapper (recommended)
Gradle home:
%AndroidStudioLocation%/gradle/gradle-3.2
Project format:
.idea
I get BUILD SUCCESSFUL.
Typically, after the build completes, in other projects I've cloned, I am able to click on Run Selected Configuration and the APK is loaded to my device using adb. But in this case, after the build, there are no Run/Debug Configurations.
Android App Template
I have created a run configuration using Run > Run... > Edit Configurations and then used the Android App template, but when I try to run that, I see this in the adb Select Deployment Target window:
(Device supports , but APK only supports armeabi-v7a, x86_64, arm64-v8a,x86)
Since I am able to load other APK's to the device, I thought the basic configuration on the device must already be correct, it's just this project in Android Studio that seems to be the problem.
But using this answer, which has me turning the USB debugging on the device off, and then on again, I was able to get the device to show normally:
Motorola Moto G (5) Plus (Android 8.1.0, API 27)
Another clue led me to the Build Variant, but the menu item Build > Select Build Variant is not enabled, so I was unable to do anything there.
Kotlin Templattes
I have also tried to configure Kotlin and Kotlin script run configurations, but it's unclear how to configure those in order to get them to do what, in past experience, "just works" (i.e. the run configuration is somehow already defined in the project without my having to do any configuration).
Question:
How can I get this application running on my device using an Android Studio run configuration?
- IDE Details:
Android Studio 3.4 Build #AI-183.5429.30.34.5452501, built on April 9, 2019 JRE: 1.8.0_152-release-1343-b01 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 7 6.1
Edit - Additional Information:
Since the build completes successfully, I am able to run, from the command line with the current directory set to the location of the *.apk file:C:\Users\Owner\AppData\Local\\Android\sdk\platform-tools\adb.exe install app-opensource-debug.apk
The problem with this approach is that the application must be manually removed from the device before this will work. This means any configuration of the app is lost. It also takes longer since it doesn't take advantage of the ability of the IDE's to run the subset of build steps (for repeated builds with small changes between them - whatever that feature is called). For these reasons, it would be more convenient to get a working run configuration.
