简体   繁体   中英

Where is InstallDebug in Gradle? How to install a test Android App?

I'm trying to install an Android app I'm developing in Android Studio on my test device. I normally do this with the Gradle task called "InstallDebug. In my newly created project however, I now don't see this task in my list of Gradle Tasks anymore. The only two things I see starting with Install* are

  • installDefaultFlavorDebug
  • installDefaultFlavorTest

Does anybody know which Gradle Task I need to use to install my app on my phone to test it?

Now you will find this tasks:

gradlew install<Flavor><Build Type>.

Example: 2 flavors f1,f2 , and 2 build types debug, release .

You will find:

installF1Debug - Installs the Debug build for flavor f1
installF1DebugTest - Installs the Test build for the f1 build
installF1Release -- Installs the Release build for flavor f1
installF2Debug - Installs the Debug build for flavor f2
installF2DebugTest - Installs the Test build for the f2 build
installF2Release -- Installs the Release build for flavor f2

I encountered a similar issue. The symptom is:

Under the Gradle-Tasks / Install category, there's only 1 task "InstallAll"

My Solution is:

1.Install Android NDK , using the SDK-Manager of Andorid-Studio.
2.Make sure the "Android NDK Location" field of the project-settings (File -> Project Structure) is not empty. It should be something similar to: /Users/charlie/Library/Android/sdk/ndk-bundle

After I have the Android NDK installed, I can see many other Install-Tasks in Android-Studio now.

If you guys don't see the installDebug option on running ./gradlew tasks under the Install Tasks section like here . Then please set the ANDROID_HOME environment variable as follows:

On Linux( Ubuntu)

export ANDROID_HOME=/home/username/Android/Sdk/ # As in my case, yours might be somewhere else

To make the above change permanent, pls add this line to your .bashrc in your home directory. (~/.bashrc) and then:

source ~/.bashrc

To get the changes in the current shell. Now, you would most likely see the installDebug in the Install Tasks when you run ./gradlew InstallDebug .

Then just connect your device from usb ( if device not visible for debugging ) and run ./gradlew installDebug

Gradle installDebug menu has disppared, manual add Gradle configuration can work! 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM