I am trying to use gradlew cAT command to perform the connected android tests with my android phone. But i get the below Error log and it cannot install the app.
The App gets installed if adb command is used.
The above command works ok with OnePlusOne phones but not in Lenovo and Asus
The error log is below:
Unable to install /home/admin/MyApp/app/build/outputs/apk/app-local-debug.apk
com.android.ddmlib.InstallException: Failed to install all
at com.android.ddmlib.SplitApkInstaller.install(SplitApkInstaller.java:91)
at com.android.ddmlib.Device.installPackages(Device.java:901)
at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:119)
at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:121)
at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:48)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
This happens to be a very common problem with most Chinese manufactured phones. The issue lies within your gradle-plugin dependencies and there are two ways you can go about solving it.
Step 1: go to sampleProject/android/build.gradle
at line 8 and Modify classpath to com.android.tools.build:gradle:1.2.3
or 1.2.1.
Step 2: go to sampleProject/android/gradle/wrapper/gradle-wrapper.properties
at line 5 and Modify distributionUrl to https://services.gradle.org/distributions/gradle-2.2-all.zip
Step 1: Locate the app-debug.apk at sampleProject/android/app/build/outputs/apk
.
Step 2:Copy and Paste into any folder in your phone then click to install it.
Step 3: Shake your phone to expose settings, click on Dev Settings then Debug Server host & port for device and configure it with your ip address(192.168.xx.xx:8081).
Start your react-native server and viola you are up and running!!!
EDIT!!!!!!!!
Doing either option listed above became so tiring and frustrating and I found another solution.
adb devices
. From the output, grab the device id H80xxxxxx.
react-native run-android --deviceId H80xxxxxx
NB: Personally I now use option 3 any time the error pops up!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With