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
Related
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.
when ever I run the cordova/build, I get following ERROR:
Execute failed: java.io.IOException: Cannot run program "../android-studio/sdk/build-tools/android-4.4W/aapt"
what should I do?
I moved my Android Developer Tools (ADT) folder from Ubuntu's partition to Linux Mint's partition, but accidentally put in inside my web server's root folder and the permission of ADT's folders were set to 755, the files were set to 644 by my shell script to rebuild the permissions for my new web server.
After I moved ADT to my home folder and started using Android Studio, I got this problem.
sudo chown $USER:$USER -R /home/myusername/my-adt-folder
doesn't help.
GNU C Library was already installed by default. Not sure why it is related to this problem.
I decided to set 777 permission to ADT and it worked.
sudo chmod 777 -R /home/myusername/my-adt-folder
That's it.
It seems another system user in the system needs to access to android-4.4W/aapt file.
I solved it by installing lib32-glibc.
https://www.archlinux.org/packages/multilib/x86_64/lib32-glibc/
If you just want aapt on Arch without the overhead/hassle of setting up ADT then you can try the solution that I presented on the Android Enthusiasts site here.
I get the latest source code on here :ics-openvpn and I want to compile it under windows environment. As in README.txt said :
Do cd main;./misc/build-native.(sh|bat) in the root directory of the
project. After that build the project using "gradle build" (Or use
Android Studio). The project is converted to gradle and building with
Eclipse is no longer supported.
But the content of file build-native.bat is:
#echo on
echo Currently broken, feel free to fix and send me a patch, see .sh file
exit 1
call ndk-build APP_API=all -j 8
cd libs
mkdir ..\assets
mkdir ..\build\
for /D %%f in (*) do (
copy %%f\minivpn ..\assets\minivpn.%%f
del %%f\libcrypto.so
del %%f\libssl.so
mkdir ..\build\native-libs\%%f\
copy %%f\*.so ..\build\native-libs\%%f\
)
cd ..
it means that author notices that this bat file contains error, that cannot be build by this. I try to remove first three lines and run again, i meet these errors:
main//jni/Android.mk:11: lzo/Android.mk: no such file or directory
main/jni/android.mk : 12: snappy/Android.mk : no such file or
directory ...
so, my question is : can we build this library on windows (because author has notified that this build file is error), and if can, how ?
Thanks :)
It is just like the text says. It is broken because I don't develop on Windows. You can look at the build-native.sh fix the paths etc for Windows. The build problems are nothing difficult but someone has to take the 10 minutes and fix it.
I got all sorts of errors using Cygwin to build this.
You may have more luck using an actual Linux box or something like VirtualBox with an Ubuntu image.
This worked for me. You will need the Linux NDK (installation instructions here) and you'll need to install make with sudo apt-get install make.
Then run cd main;./misc/build-native.sh from the project root.
I'm trying to get set up with an Android development environment using IntelliJ in Ubuntu 12.04. I create an Android Application Module, but when I try to build, I get the following error:
android-apt-compiler: Cannot run program "/home/jon/Programs/android-sdk-linux/platform-tools/aapt": java.io.IOException: error=2, No such file or directory
Several hours of scouring the internet hasn't helped.
By the way, I ran locate aapt in the terminal and found that aapt is located at /home/jon/Programs/android-sdk-linux/build-tools/17.0.0/aapt
It appears that the latest update to the r22 SDK release moved aapt and the lib jar from the platform-tools to the build-tools directory. While we wait for JetBrains to release an update, here's a quick fix using a couple of symbolic links:
From your AndroidSDK/platform-tools directory, run the following:
ln -s ../build-tools/17.0.0/aapt aapt
ln -s ../build-tools/17.0.0/lib lib
...and IntelliJ should be able to compile as normal.
update your IntelliJ to 12.1.4 by using beta releases as the update channel
In Windows it is enough to copy only aapt.exe, lib\dx.jar and dx.bat
from build-tools\android-4.2.2
to
platform-tools
The same problem occurred for me with android-studio. But, this probably applies to the IntelliJ IDE as well.
When checking the file location I saw, however, that aapt was in the expected location.
In my case the issue was that I was running a 64-bit Ubuntu linux system which cannot execute the 32-bit aapt executable.
Installing 32-bit compatibility libraries solved this issue in my case: sudo apt-get install ia32-libs
i solve it with this to line commands
ln -s ~/Programs/android-sdk-linux/build-tools/17.0.0/aapt ~/Programs/android-sdk-linux/platform-tools/aapt
ln -s ~/Programs/android-sdk-linux/build-tools/17.0.0/lib ~/Programs/android-sdk-linux/platform-tools/lib
I also noticed it.
ADT has been updated and they added this new build-tools where they moved everything.
Intellijidea is not updating paths so it's searching aapt in the old path.
I don't know how to solve it, so let me know if you find a solution...
UPDATE:
I think that you have only 2 options:
1) Use Android Build studio: http://developer.android.com/sdk/installing/studio.html
2) Copy (this is dirty but works) all content from build-tools/17.0.0/ to platform-tools/ and it will build
To complain to Jetbrains, go here: http://youtrack.jetbrains.com/issue/IDEA-107311
I reckon more votes will be a faster fix.
Thanks for the tip! On a mac running the Android 4.2.2 SDK, this worked great. You'll just need to update your paths accordingly. E.g.
ln -s ../build-tools/android-4.2.2/lib lib
ln -s ../build-tools/android-4.2.2/aapt aapt
I ran into this issue but with android-maven-plugin
and as a variant of your item #2 rather than copying the file(s) I simply created a symbolic/soft link for aapt
cd platform-tools
ln -s ../build-tools/17.0.0/aapt ./
This approach seemed to get all my builds functioning again.
Clone the android-maven-plugin on GitHub and install it in your repo
git clone https://github.com/jayway/maven-android-plugin.git
cd .../maven-android-plugin/
mvn clean install
Then update your pom to use version 3.5.4-SNAPSHOT of the plugin.
Everything should work properly !
I ran these three commands and my problem was resolved
mklink "%ANDROID_HOME%\platform-tools\aapt.exe" "%ANDROID_HOME%\build-tools\17.0.0\aapt.exe"
mklink /D "%ANDROID_HOME%\platform-tools\lib" "%ANDROID_HOME%\build-tools\17.0.0\lib"
mklink "%ANDROID_HOME%\platforms\android-17\tools" "%ANDROID_HOME%\build-tools\17.0.0\aidl.exe"
If you haven't set ANDROID_HOME Environmental variable the replace %ANDROID_HOME% with the path to your android SDK e.g. C:\Android\android-sdk
On Mac OS you need to
$ cd platform-tools
$ ln -s ../build-tools/android-4.2.2/aapt aapt
$ ln -s ../build-tools/android-4.2.2/lib lib
Goodlife once again.
Just incase of such an error clean project and you are good to go.
I use Ubuntu 11.10 and eclipse for Android development. I used to keep the android-sdk in my home folder, but because of low space, I copied it to the hard disk. When I moved the sdk to the hard disk, I did not have permissions to run adb, aapt or other platform tools. So, I edited the /etc/fstab file and added the following line
/dev/sda3 /media/hdisk ntfs-3g defaults 0 0
Now, when I execute the command ls -l | grep "sdk" in the terminal, i get this output
drwxrwxrwx 1 root root 4096 2012-10-20 16:07 android-sdk-linux
So, I have the permissions now, but when I run eclipse, the R.java file is still not generated, but the BuildConfig.java file is generated. I can run aapt from the terminal, but doing it every time I change the code is not practical. Any suggestions?
In case you have a 64bit Linux running, this command may help you:
sudo apt-get install ia32-libs
Had the same issue and that one did the trick. Found here.
Its a very basic check but have you changed the location of the Android SDK within Eclipse?
Preferences -> Android -> SDK Location
This problem seems have to solved itself after restarting my PC about 2-3 times. Thanks for all the help everybody.