2

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?

kramer65
  • 50,427
  • 120
  • 308
  • 488
  • is there a reason why you don't install the debug version of your app by IDE? – owe Jan 30 '14 at 13:15
  • @owe - I'm not sure what you mean. The problem I have is that I normally simply click Gradle on the left, and select InstallDebug from the list of available Gradle Tasks. But in my current project, the installDebug option is not listed in the list of Gradle Tasks.. – kramer65 Jan 30 '14 at 13:19
  • I don't know if we talk about the same thing, but you also could just choose the right `BuildVariant` and `Run` your configuration. – owe Jan 30 '14 at 13:26

4 Answers4

4

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
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
1

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

aspiring1
  • 344
  • 1
  • 13
  • 32
0

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.

fanyangxi
  • 562
  • 7
  • 6
0

Gradle installDebug menu has disppared, manual add Gradle configuration can work! enter image description here

sonichy
  • 1,370
  • 2
  • 14
  • 17