Does anyone know how to auto-run a command or a script in GNURoot Debian when opening a new terminal window?
I'm trying to make make an SSH server run automatically when I open GNURoot,
so right now I'm manually typing:
service dropbear start
I found an "Initial Command" option in the GNURoot app preferences and typed the command in there, but it doesn't seem to do anything. Even worse it seems to make the new terminal window to open up in a non-working state where I can't run any command.
thanks!
First root your device. Then find the file com...xml in /data/data/com.gnuroot.debian/shared_prefs/, change its initialcommand value to empty. Then your gnuroot should launch ok. I just met this question and checked androidterm source code to find this solution.
Related
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".
I am using Eclipse to debug an Android application on a device. I would like to keep the application data between debug sessions. I should be able to do this from the command line with something like this:
adb uninstall -k com.package.myprogram
adb install -r MyProgram.apk
But then, I have to debug on the command-line -- Eclipse is much nicer! Is there anyway to set these options for when I am debugging with Eclipse?? Or somehow set these options through an ADB shell, but then still use Eclipse for catching Breakpoints?
Eclipse does not do any black magic! for all matters ends up accessing adb.exe to talk to the device. by just typing adb on your command line, you will get host of options with which you can do a lot of things. Apart from adb, there are other tools too which can help debug. Research a bit on which suits you best.
Just create a launch configuration for your Android project in Eclipse (in the Run menu). If you modify your application code and run the launch configuration again, Eclipse will install the new version of your application on the device without touching any of its data. There is absolutely no need to uninstall the old version first.
I have the code.google.com Android SDK, am able to launch the emulator and created a v3.0 object and its started and runs fine, but am just trying to "install" and launch an existing application. its a database viewer with a .apk extension. I have the source, but right now to start its a compiled app.
How is this done?
thanks!
fire up your emulator (it has to be running when you do this), then open Terminal and type
>adb install your_program.apk
You have to cd over to the directory where the file is, first.
(the > is the terminal prompt... not a character you should be typing)
oh, and if you then want to uninstall it, you can do it right through the emulator, of if you know the actual package name you can then do it like...
>adb uninstall com.full.package.name
Oh, and I guess I'm giving mac advice cause I'm on a mac... if you're on a PC you'll use the command prompt... I'm assuming the rest is the same.
I've been programming for Android devices for some time now and just recently came across this:
There is a single one in the list online, but I can't run/debug my programs because it reports "ADB rejected install command with: device offline" since every other device has the same ID.
A reset fixes this, but is there any other options? Why is this happening?
Exit eclipse, kill adb and restart eclipse
I find that the issue is often with a bad cable or connection. Try and insert it into another USB slot or try with a different cable, worked for me.
I had to remind myself how to call the commands, so I thought I'd write an answer for other people that don't remember how.
Find the location of adb.exe.
Open up command prompt.
In command line, change the directory to the directory from step 1.
For me, the command and directory is: cd C:\ADT\sdk\platform-tools
Run: adb kill-server from the command prompt
Run: adb start-server from the command prompt
Credits to Squeazer for the commands.
When I want to test an android application, I create a new AVD, start it in the emulator, wait for the emulator to finish booting, and then use ADB to install the application, and when I'm done delete the AVD. Are there any tools that automate all of those steps? I tried writing my own but I couldn't find a way to tell if the emulator was completely booted, as the Android SDK website says not to use "adb wait-for-device install file.apk".
You're right not to use wait-for-device. It does not wait for the package manager to be available, which is what you need. I'm not sure how eclipse does it but you can poll the emulator until the package manager is available using the command adb shell pm path android. The command should return 'package: something'. Check out this python script that uses the technique: www.netmite.com/android/mydroid/1.6/.../adb_interface.py. It's pretty big but if you search for the command above you'll find the relevant piece of the script.
Why do you want to delete the AVD every time?
If you are deleting it every time because the install command throws an error due to the app already existing on the AVD, you can do this: adb install -r file.apk. The -r part is used for reinstalling the app. Here is the full usage instructions for adb.
Are you deleting it to remove the application you are testing and revert to a 'clean' emulator? If so it's not necessary to delete the AVD every time. You can specify the -wipe-data option when starting the emulator. This effectively resets the AVD to how it was when you created it. Here is the emulator documentation.
Hopefully that helps simplify your script.