Cannot run Android ADB command - android

I am using Android Studio v0.8.14 to create a an Android Wearable app. Since I am new I am following the instructions from the android site: https://developer.android.com/training/wearables/apps/bt-debugging.html#SetupSession
I was able to pair the wearable (Moto 360) with my handled device (Samsung Galaxy S4. Kitkat OS v4.4.2). As per the instructions provided the next goal is to set the debugging session. Here I am trying to run the adb commands as shown:
adb forward tcp:4444 localabstract:/adb-hub
adb connect localhost:4444
But as soon as I the first command my Android Studio gives me the following errors:
Cannot find file '/Users/Desktop/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/forward'
Cannot find file '/Users/Desktop/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/tcp'
Cannot find file '/Users/Desktop/software/adt-bundle-mac-x86_64-20140702/sdk/platform-tools/localabstract:/adb-hub'
Can someone please explain me what is am I doing wrong here?
Thanks
Raj

I use this solution in my mac ... just run the command:
export PATH=/Applications/Android\ Studio.app/sdk/tools:/Applications/Android\ Studio.app/sdk/platform-tools:$PATH
It's necessary to run this command every time you open a new terminal. Save this in your path to set permanently..

Related

adb devices is not recognised as a known command

I am trying to set-up a command in Android studio that would allow me to see the current active devices like in this tutorial (1:39:41):
I have opened the environment settings and created the variable adb devices like it was explained in the tutorial
However, when I run it in Android Studio Terminal, the command is not recognised:
What did I do wrong?
The problem is with your naming. Try remove the white space and it will work.
Cause you type adb with argument devices.
Try change your variable to adb
then type
$ adb devices
and it will work

React native error in launching app with android emulator

I get following error when I run react-native run-android in CMD(windows command prompt)
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
What caused This problem?
Thanks in Advance.
check your device connected or not by execute below command in cmd
adb devices
if adb not found then open below dir
C:\Users\MANGO\AppData\Local\Android\sdk\platform-tools
then check device connected or not
then you can lunch your app
i hope it solve your problem
Set the sdk platform tools path in system variable inside Enviroment variable.
With this you can check the connected devices from command promt.
Note: Make sure you have connected your device to PC with USB debugging On from developer menu. You can follow this link
Then follow following steps.
From command prompt type " adb devices ", if you are connecting the real android device first time then inside your device there will be a RSA key generated which you have to click "OK".
Then to confirm from devices you can again type adb devices if all went good it will show your device.
Move to your project folder from command prompt and then run your app from command prompt.

React Native 'hello world' quick start: "could not connect to development server"

I'm trying to do the react native 'hello world', and I'm using usb debugging on my android.
I ran react-native run-android, then react-native start.
I can view the js file in localhost, but get 'could not connect to development server' message on my phone.
I followed the instructions to run adb reverse tcp:8081 tcp:8081, then realized that command doesn't exist, so I ran adb forward tcp:8081 tcp:8081 instead.
Still no luck. Using react-native#0.22.0, ubuntu 14.04. My phone is nexus 5 on android 6.0.1.
How can I allow my phone to access my localhost?
By the way, it is working over wifi, but I'd like to get it working over usb.
Just another scenario, this error happened to me when I forgot to run react-native start command. I usually follow the steps here when I start new project. The steps in a nutshell are as follows (Android in my case):
Start Android Studio -> AVD Manager -> select your aVD and click Start from action
inside the directory where you want to create your new project, open your command line and run:
$ react-native init <Your new project name/it is also the registration name>
$ cd <the new directory you created>
$ react-native start //This is the step that I forgot
Open a new command prompt and run the following inside the same directory(you just created) to launch the app on your AVD.
$ react-native run-android
If everything is set up correctly, you should see your new app running in your Android emulator shortly.
You'll find in the file index.android.js in the home directory of your project, the last line contians the App registry using the same name you used in the first command above
adb reverse tcp:8081 tcp:8081 Only works for android 5.0 + for running app on devices with android versions lesser than 5.0 hit following command after npm start is done in Terminal (in app directory folder).
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
now run the app, it will work. Only drawback is that every time you make a change you need to fire the command again and run the app again.
I found the solution :)
I am on ubuntu 16, so, I used command ip addr show which gave me my computer ip address.
I used this ip address and I was able to access localhost on my mobile.
Finally I added the ip address and port no to devsettings of android phone and My app was able to access development server
10 mins ago I had the same problem I guess, and the way I solved this was reading this
https://facebook.github.io/react-native/docs/running-on-device-android.html
and when I did that, I found that I didn't have android-tools-adb installed,
so looking around I found
'No command 'adb' found' error on Ubuntu
which gives me the answer
sudo apt-get install android-tools-adb
and after all this I set
export PATH=${PATH}:~/android-sdk-linux/tools
export PATH=${PATH}:~/android-sdk-linux/platform-tools
then everything works fine, now I can see my app in my Android device.
BTW the option I choose from react native docs was the one that says me
"Using adb reverse
Note that this option is available on devices running Android 5.0+ (API 21).
Have your device connected via USB with debugging enabled (see paragraph above on how to enable USB debugging on your device).
Run adb reverse tcp:8081 tcp:8081
You can use Reload JS and other development options with no extra configuration
I am having seen the same issue, and that's all because the android app don't have this permission:
<uses-permission android:name="android.permission.INTERNET" />
I had a similar problem. I would get this error when trying to get it to run on device. It was working fine on my simulators on my computer.
The problem was when I would do adb devices or react-native run-android I would get "ADB is Not Recognized as an internal or external command".
So my fix was to add the path to adb.exe's parent directory to my Environment Variables and then restart my command prompts. After I did that, adb devices would not throw the "unrecognized internal external blah" and it listed my device. I then ran react-native run-android and on startup no more red screen showing the completely useless error message Error calling AppRegistry.runApplication! :)
So I found ADB was located in my folder:
C:\Users\dell\AppData\Local\Android\sdk\platform-tools\adb.exe
I am on a Windows 10 system. dell is my user name of the computer.
So I went to System Environemnt Variables then found "Path" then clicked "Edit", then clicked "New" and added in "C:\Users\dell\AppData\Local\Android\sdk\platform-tools".

Cannot get com.android.vending.apk and com.google.android.gms.apk installed

I'm a beginner of android developing. I'm working in a project requires google map api.
I followed the success examples posted on Stackoverflow step by step and downloaded com.android.vending-20140218.apk and com.google.android.gms-20140218.apk. Then I copy and paste these two apk files in the same direction of my adb application, under ~/sdk/platform-tools. When I run adb command in my cmd window, first I navigate to my adb path, in my computer it's: A:\Eclipse\eclipse\sdk\platform-tools, then I tried to run the command: adb install com.google.android.gms-20140218.apk, but It failed. cmd shows: no device found. Waiting for device.
I tried many times on different computers. The same problems comes out and didn't get any information by google this problem. Thanks so much for any suggestion!
You should run an android emulator first that you've created. Then check the running device:
adb devices
if your emulator was detected, you could try to run your:
adb install com.google.android.gms-20140218.apk

how to connect HTC phone in Ubuntu for development and app testing?

I am working on phone gap and trying to build an app for Android. When i connect a device HTC Desire HD it connects in a few seconds and when try to run phonegap App on it , it get installed. But, i have another phone Incredible S, whe i try the same procedure on it it shows ?????? tried several things available on net to get it detected and work with ubuntu but unable to do so ? it also says unknown device here is link for the snapshot http://img6.imagebanana.com/img/tfprcxip/Selection_001.png . How to get out of this issue ?
You have to restart your ADB. Follow the below steps.
1)Open a terminal and login as root.
2)navigate to the directory where you have this ADB. (Normally /opt/android-sdk/platform-tools).
3)now execute ./adb kill-server and then ./adb start-server.
4) Now you should be able to see some msg like this, "Daemon started successsfully".Else repeat 3rd step. That's it.

Categories

Resources