I updated Nexus 7 with Android Lollipop and now i can't access SQLite db from IntelliJ IDEA 14. Everything was working fine before Lollipop update, even though Android wasn't rooted i could access db from IntelliJ (but not pull it via ADB).
The error i am getting when i try to connect is:
Data Source Synchronization Error
Cannot synchronize 'SQLite': run-as: exec failed for /data/local/tmp/intellij_native_tools/get_modification_time Error:Permission denied
I am aware that SQLite was updated in lollipop from 3.7 to 3.8. What could cause this kind of error? Wrong DB creation, old DB drivers, something else?
adb root doesn't resolve anything, there's numerous issues depending on environment. Here's how I got it working on emulator where I spend a lot of my development time.
First we need to resolve the error only position independent executables (PIE) are supported with the binary.
get the source of android ultimate plugin tool:
git clone https://android.googlesource.com/platform/tools/adt/idea
cd idea/android/ultimate/get_modification_time/jni
Apply the following patch:
diff --git a/android/ultimate/get_modification_time/jni/Application.mk b/android/ultimate/get_modification_time/jni/Application.mk
index a252a72..bdf815d 100644
--- a/android/ultimate/get_modification_time/jni/Application.mk
+++ b/android/ultimate/get_modification_time/jni/Application.mk
## -1 +1,2 ##
APP_ABI := all
+APP_PLATFORM := android-16
You'll need to setup a recent version of NDK to build, I had ndk-r10d installed already.
# ndk-r10d
ndk-build
cd ..
cp -R libs native_tools
# update the intellij plugin with whatever arch you plan to use
# adjust the path here to where your copy of IntelliJ is located
zip -u ~/local/apps/idea/plugins/android/lib/android-ultimate.jar native_tools/*/get_modification_time
Note that you need to update the path in that last line to point to your local IntelliJ installation. For example, on MacOS, it'll be:
zip -u /Applications/IntelliJ\ IDEA\ 14.app/Contents/plugins/android/lib/android-ultimate.jar native_tools/*/get_modification_time
Restart IntelliJ.
Next, we'll be replacing /system/bin/run-as on the emulator. Create the following script locally and name it run-as.
#! /system/bin/sh
INTELLIJ_NATIVE="/data/local/tmp/intellij_native_tools/get_modification_time"
if [ "$2" = "$INTELLIJ_NATIVE" ]; then
cd /data/local/tmp/intellij_native_tools
./get_modification_time "$3"
else
/system/bin/run-as.org "$#"
fi
Start the emulator. After it has booted, update it.
# update run-as after start
adb shell mount -o remount,rw /system
adb shell mv /system/bin/run-as /system/bin/run-as.org
adb push ./run-as /system/bin/run-as
Now you can synchronize to your heart's content.
Note, you may also want to follow progress on the bug upstream which just had priority bumped after posting this: https://youtrack.jetbrains.com/issue/IDEA-137606
If you have a rooted device try command
adb root
After it IDEA synhronization is successfull.
Related
I'm on ubuntu 16.04 and try to install on my lollipop 5.1 tablet, native api webrtc example (AppRtcMobile example).
I successfully installed chromium on my lollipop device. Now after removing the folders used to install chromium on the lollipop device from the ubuntu pc I'm trying to compile an example project about webrtc using the grandle system or adb at the command line. But the compilation always stops at the same point.
Unfortunately, I'm new to git, ninja, fetch and gn, so I do not understand where the error is.
I follow the procedure that I describe below (as I understand that the commands work) and create 3 different installation directories so as to install even on devices other than "arm".
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=$PATH:/my-path/to/depot_tools
mkdir ~/webrTEST && cd ~/webrtcTEST
fetch --nohooks webrtc_android
gclient sync
./build/install-build-deps.sh
gn gen out/DebugArm --args='target_os="android" target_cpu="arm"'
gn gen out/DebugArm64 --args='target_os="android" target_cpu="arm64"'
gn gen out/DebugX64 --args='target_os="android" target_cpu="x64"'
ninja -C out/DebugArm
ninja -C out/DebugArm64
ninja -C out/DebugX64
. build/android/envsetup.sh
ninja -C out/DebugX64 AppRTCMobile
I try to study more than one "tutorial" and the offial guide too, but ninja retur everytime the same result:
myuser#mymachine:~~/webrtcTEST/src$ ninja -C out/DebugX64 AppRTCMobile
ninja: Entering directory `out/DebugX64'
ninja: no work to do.
Anyone can suggest my where is/sre my error?
regards
bkt
UPDATE:
using ls command not find AppRTCMobile but other app example or other ...
the command:
ninja -C out/DebugX64 :xxxx/xxxx/xxxx
work great ... so at these point the question change into:
where is the old AppRTCMobile example located or which is the new name of the example that allows me to android lollipop to use the server google appr.tc ??
Any how if in my manner of install the webrtc-android git there are some error please help my to find it.
regards
bkt
I did not understand the reason, but by deleting everything and re executing the procedure written in the application I got the desired result and I compiled AppRTCMobile.
I downloaded Android Studio 2.3.3 for Linux and unzipped the content to /usr/local
then
$ cd android-studio/bin
Edited the file idea.properties and appended a following line to it:
disable.android.first.run=true
Then launched Android Studio:
$ sudo sh studio.sh
Looking in classpath from com.intellij.util.lang.UrlClassLoader#1a7cec2 for /com/sun/jna/linux-x86/libjnidispatch.so
Found library resource at jar:file:/usr/local/android-studio/lib/jna.jar!/com/sun/jna/linux-x86/libjnidispatch.so
Trying /root/.AndroidStudio2.3/system/tmp/jna5562911082428971611.tmp
Found jnidispatch at /root/.AndroidStudio2.3/system/tmp/jna5562911082428971611.tmp
[ 40066] WARN - dea.updater.SdkComponentSource - File /root/.android/repositories.cfg could not be loaded.
^C[18124266] WARN - pl.local.NativeFileWatcherImpl - Watcher terminated with exit code 130
And it will stuck. After long waiting I termited it with Ctrl+C
Try attaching to the process with strace to see what it's doing (for example, waiting on a network or file). Or run it with strace like this:
strace -o foo.log -s1024 -f ./studio.sh
After a while, break it with Ctrl-C and examine the log file for syscalls like open, read, recvmsg.
Alternatively, while it's running, you can attach with a Java profiler to the jvm. For a start, you can launch jconsole or jvisualvm and attach to the Android Studio (it will show as an empty name, with only PID) and view stack traces of individual threads. In jvisualvm you can view the CPU usage sample and click on the hot event and see the stack trace.
Basically you need to find out what the app is trying to access for so long. Most likely some network resource.
I think all your problems happen because you ran as root (sudo) on your first run.
So try to unroot before doing a clean install like I suggest below:
Unroot the installation
cd to the folder where you unzipped Android Studio before
cd ..
Recursively change user and group:
sudo find <thedirname> -print0 | xargs -0 chown <yourusername>:<yourgroupname>
cd ~ or cd to go back to home
Recursively change user and group
sudo find .Android* -print0 | xargs -0 chown <yourusername>:<yourgroupname>
(I sudo because you've used root user previously).
Recursively change user and group
sudo find Android* -print0 | xargs -0 chown <yourusername>:<yourgroupname>
cd into the unzipped directory. Do chmod +x studio.sh.
Start Android Studio ./studio.sh
If it didn't help, do a:
Clean install
Download and unzip a fresh copy of Android Studio. I suggest version 3, it's pre released, but stable. It doesn't matter where you put it.
I believe you have Java installed, but make sure you have Java 8 as the default one: in command line: java -version, make sure it's 1.8.
Move any old installations out of the way, in case they are corrupt:
sudo mv ~/.Android* ~/tmp/
sudo mv ~/Android ~/tmp/
should do the trick. (I sudo because you've used root user previously).
cd into the unzipped directory. Do chmod +x studio.sh.
Start Android Studio ./studio.sh
Make sure all the files are owned by your username, and group as well.
I took some information from:
Stuck at “.android/repositories.cfg could not be loaded.”
Installing Android Studio in Ubuntu 14.04 64-Bit .android/repositories.cfg could not be loaded
The answers collectively say that:
Android Studio will run fine without repositories.cfg.
You can remove this warning by putting the following into repositories.cfg:
### User Sources for Android SDK Manager
count=0
After waiting some time it eventually goes beyond that step.
Patience is the key.
So, try waiting a little bit more. It always helps.
This is common. On your first run the gradle files are needed to be downloaded and installed in background. It's about 90 MB in size and even if your internet speed is high, the gradle servers may be slow taking it to maximum of 1 or 2 hours in the worst case. So open Android Studio and wait until it opens. Hope it helps.
I've found a potientaly useful link from AskUbuntu, the guy suggested creating an empty file called repositories.cfg. And that solved it.
Ref: https://askubuntu.com/questions/885658/android-sdk-repositories-cfg-could-not-be-loaded
Just remove /root/.AndroidStudio2.3 and /root/.android (after making a backup)
Maybe it has something to do with the script looking at the root location. Have you tried using chown on the unzipped content directory?
Try this to install
Download the studio
Extract to home
go to android-studio/bin/
Mouse right click than open terminal
type ./studio than press enter
now it will start to install studio. If you installing first time than It will download some files of SDK. and if you have already downloaded SDK than you can cancel download and set you SDK path from the setting from right bottom corner.
try creating repositories.cfg -- Because I see it as warning. Let's see what happens after that!
touch ~/.android/repositories.cfg /* Linux */
Extract your downloaded Android Studio setup zip file to your /home/<user_name> directory and in terminal follow the below commands
$ sudo chmod +x studio.sh
And hit enter
Now run the following command
$ ./studio.sh
And wait for some time to download the required libraries.
This page documents running an old version (1.8.4) of mercurial but says
"(later versions need an unavaliable python module named grp)"
This is the way I did it (but am still interested to hear of alternative ways) using an Ubuntu 16.04 machine and a intel 64bit android emulator running on Windows 7, using mercurial 3.7.3
Using an Ubuntu system, follow these instructions for creating 2.7 version of python capable of running hg.
Copy python onto android device into an app files directory (so it can be executed)
on windows host
adb push python279.x86_64 /sdcard
adb -e shell
on android device
cd /data/user/0/$SOMEAPPDIR/files
cp -Rav /scard/python279.x86_64 .
make python excutable
chmod +x python279.x86_64/bin/python2.7
set some env vars need to make python run on android
export LD_LIBRARY_PATH=/data/user/0/$SOMEAPPDIR/files/python279.x86_64/lib
export LD_PRELOAD=libffi.so:libbz2.so
export PATH=$PATH:/data/user/0/$SOMEAPPDIR/files/python279.x86_64/bin
Python should now be able to be run with python2.7
Build mercurial on Ubuntu host.
download mercurial 3.7.3
uz mercurial-3.7.3.tar.gz
cd mercurial-3.7.3 && make all
HOME=$PWD/dist make install
Make minor modifications
cd dist/mercurial-3.7.3/dist/lib/python/mercurial
rm *.so
cp pure/*.py .
Edit posix.py and delete the "import grp" line.
copy mercurial onto android device
on windows host
adb push dist /sdcard
adb -e shell
on android device
cd /data/user/0/$SOMEAPPDIR/files
cp /sdcard/dist .
alias hg to make it easy to use
alias hg='python2.7 /data/user/0/$SOMEAPPDIR/files/dist/bin/hg'
Hg should now be possible to use on android device.
It's even possible to clone remote repos but I also had to pass the --insecure flag to bypass ssl errors.
The answer made on "Feb 15 '17" works fine however there is one fairly big drawback.
This answer address this drawback and is intended to be used in conjunction with the previous answer.
The problem
This procedure:
rm *.so
cp pure/*.py .
removes the native libraries and uses the python 'pure' implementation of these libraries instead. This causes major performance problem when working with large repositories, especially on slower android devices.
The solution
Cross compiling mercurial with android ndk, produces native libraries that can be used on android.
I've added some helper scripts to a mercurial 4.8.2 fork to make cross compiling easier.
Linux instructions:
Clone the repo
hg clone https://bitbucket.org/hindlemail/hg-stable-android/
update to 331892efe015
hg update -r 331892efe015
Set these for environment variables with appropriate values:
provide location of android NDK
ANDROID_NDK="$HOME/Android/android-ndk-r13b"
specify build arch - (armeabi, x86, x86_64, arm64)
ARCH="armeabi"
specify target android sdk verison
PLATFORM="android-22"
specify output of cross compiled python.
(see answer from Feb 15 '17" for more info )
PYTHONDIR="/usr/local/android/install/python279.arm22"
Run crosscompile.sh
I am running a calabash-android test using docker. When I build the container with my docker file it seems like nothing executing except the first line. When I check whether ruby installed or not it shows the ruby version. Apart from that nothing is working. I am adding the docker file structure here.
############################################################
# Docker file to run Calabash for android automation testing.
############################################################
FROM ruby:2.1-onbuild
# install Android SDK dependencies
RUN apt-get install openjdk-7-jdk
# Install android sdk
RUN wget http://dl.google.com/android/android-sdk_r23-linux.tgz
RUN tar -xvzf android-sdk_r23-linux.tgz
RUN mv android-sdk-linux /usr/local/android-sdk
RUN rm android-sdk_r23-linux.tgz
# Install Android tools
RUN echo y | /usr/local/android-sdk/tools/android update sdk --filter platform,tool,platform-tool,extra,addon-google_apis-google-19,addon-google_apis_x86-google-19,build-tools-19.1.0 --no-ui -a
#install calabash-android
RUN gem install calabash-android
ENV ANDROID_HOME /usr/local/android-sdk
ENV ANDROID_SDK_HOME $ANDROID_HOME
ENV PATH $PATH:$ANDROID_SDK_HOME/tools
ENV PATH $PATH:$ANDROID_SDK_HOME/platform-tools
ENV JAVA_HOME /usr/lib/jvm/java-7-oracle
I have followed this link to implement the Docker file. Since this is for the first time I am setting up docker for android haven't the faintest idea whether it is proper or not. Someone please help to fix the issue. All kinda helps are appreciated.
I get this response for the docker build
Step 0 : FROM ruby:2.1-onbuild
# Executing 4 build triggers
Trigger 0, COPY Gemfile /usr/src/app/
Step 0 : COPY Gemfile /usr/src/app/ Gemfile: no such file or directory
First, as long as the docker build does not execute all the steps, it is perfectly expected to not see anything installed.
Second, the ONBUILD directives from the ruby:2.1-onbuild are made to complete the image when building a new one from said image.
As I mention before, you can try first using
FROM ruby:2.3.0
That does not require extra onbuild trigger.
I'm trying to setup Android development with Eclipse (Indigo), on Fedora17.
Almost everything seems to work, just the javah is missing, to build the C headers with, for native (NDK / JNI) modules.
On my windows install of the tool chain it was in the same folder javac was in, but this is not the case on the Linux machine.
I previously installed Oracle's JDK1.7, found out that it's to new for something else I wanted to do (but also there, no javah), uninstalled it, now JDK1.6 is installed.
What might be wrong?
In linux machines, JavaH is normally located in /usr/bin/javah.
If you try to find this file with locate, it is normally a good idea to run before updatedb, since the database is not updated unless this command is run either by the user or a cron job. You could try finding the file with find / |grep javah
P.S. Sorry to post this as an asnwer. I suppose the corret way to go would have been a comment, but still don't have enough reputation to post a comment
This tool has been removed from the JDK
https://openjdk.java.net/jeps/313
Try gjavah rather than javah?
It turns out that javah link is not created during JDK install. You have to create it manually:
Check where is installed java:
$ ls -l `which java`
lrwxrwxrwx root root 26 15 juil. 02:05 /usr/bin/java -> /usr/java/default/bin/java
Create the symlink in the same directory:
$ su
# cd /usr/bin
# ln -s /usr/java/default/bin/javah