I have installed SDKMAN! as root on my server and want all my users (developers) to have access to it.
For that I did:
export SDKMAN_DIR="/usr/local/sdkman" && curl -s "https://get.sdkman.io" | bash
source "/usr/local/sdkman/bin/sdkman-init.sh"
Then for a user, I added these lines at the end of .profile and .bashrc:
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="/usr/local/sdkman"
[[ -s "/usr/local/sdkman/bin/sdkman-init.sh" ]] && source "/usr/local/sdkman/bin/sdkman-init.sh"
From that user (non root), the sdk command works, but when I try to install Java, I get a lot of errors for folders and files permissions, that's OK because most of those where created by root, not by my current user.
Then I try:
sudo sdk install java 9.0.4-open
And got:
sudo: sdk: command not found
Not sure what I'm doing wrong, maybe I need to install SDKMAN! for each user on my server, which would be a pain.
Any suggestions?
It seems it is not possible to install SDKMAN! once as root and that be available for all users. I guess each user needs to install it and then each users needs to install it's own version of Java, which is a pain if I manage one server and need several users to have the same configuration.
When I start Android Studio I see the following:
Internal error. Please report to https://code.google.com/p/android/issues
java.lang.IllegalStateException: Couldn't create Engine
at com.google.android.filament.Engine.create(Engine.java:46)
at com.google.ar.sceneform.plugin.viewer.Filamentor$3.run(Filamentor.java:103)
How I can solve this problem?
Make sure you have folders .cache and .local owned by your user (not root).
To change owner you need to run this:
sudo chown -R your_user_name:your_user_group .cache
sudo chown -R your_user_name:your_user_group .local
Make sure you download the Application from the official android studio website. Install it again and give you laptop full access to the internet because apart from the Studio software it downloads many other plugins and sdk tools etc, so install it again giving it full access to the internet. I hope it helps.
I develop plug-in that works under Ubuntu. The plug-in is required to install a third party software with which it works.
Installation directory is "user home" [System.getProperty("user.home")]
After installation, when I try to open the executable file from this third party software is throwing an exception -
java.io.IOException: Cannot run program >/home/mbaev/Tools/flasher/1.5.0/lua5.1.sh": error=13, Permission denied"
Where should be installed a third party software? Why this directory have permissions by default?
There are probably two reasons:
lua5.1.sh is not executable. You can make it executable by setting:
sudo chmod +x /home/mbaev/Tools/flasher/1.5.0/lua5.1.sh
And then run it:
./home/mbaev/Tools/flasher/1.5.0/lua5.1.sh
If lua5.1.sh is executable but still says error=13, Permission denied. Maybe in this shell some of operations need root permission. Try to run it by sudo:
sudo ./home/mbaev/Tools/flasher/1.5.0/lua5.1.sh
This might also belong to Ask Ubuntu.
Anyway, in order to run a script on linux, you need to have access rights to the directory the script is in, and execute rights set on the script. Most likely you are missing the exec rights.
The command
chmod u+x <myscript.sh>
Will add execute rights for the current user. Try that first.
After clean install of Android Studio I always get the error
Error:java.util.concurrent.ExecutionException:
java.lang.RuntimeException: No server to serve request. Check logs for
details.
and
Error:Execution failed for task ':Application:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.
Java is up to date and the path is set.
I am new to Android Studio, what should I try?
We ran into the same issue, and have been able to find the root cause: The error message means that Gradle cannot connect to some worker processes. In our case, the process was for 'aapt2'. Running 'ldd aapt2' indicated that some shared libraries were missing (mainly GLIBC). Since we're using Docker based on Alpine Linux, it comes with a reduced GLIBC (glibc-musl). The solution was to simply install glibc in the Docker container.
I suggest you run ldd build-tools/{version}/aapt2
to see which libraries are missing from the OS. You did not mention your OS, are you also using Docker and AlpineLinux ?
In my case, I did not need to re-download the sdk. I closed Android Studio and ran the following command in the Terminal:
sudo chmod 777 -R ~/Desktop/AndroidStudio
...where, ~/Desktop/AndroidStudio was the folder structure after Root which I needed to mention in order to provide permission to read all the SDK packages and perform required operation as and when necessary by the Android Studio, because my Sdk folder was inside "~/Desktop/AndroidStudio".
I am running Android Studio 3.0.1 on Ubuntu 16.04 LTS. This worked for me perfectly :-)
This error occurred because you might have accidentally remove the executable flag from aapt2 which is located in $ANDROID_HOME/build-tools/27.0.2.
Try this:
Re-download the sdk (recommended)
followed by-
sudo chmod 777 -R $ANDROID_HOME
Note:
$ANDROID_HOME is the location where I put android sdk
Hope this helps !!
Had to uninstall Android studio and delete the following
SDK folder in AppData folder
Delete .gradle folder
delete .AndroidStudio Projects folder
and did a fresh install which solved .
I had this problem on lubuntu-16 32bit (and also some other problems too). all of the problems were solved when I updated my system to lubuntu-16 64-bit.
Here how I fixed this Issue:
1.Deleted .gradle folder.
2.Closed android studio and run as administrator.
On Start android studio will rebuild the folder you deleted.
sudo chmod 777 -R $ANDROID_HOME
Note: $ANDROID_HOME is the location where you put android sdk
Hope this helps !!
If it is possible for you, please delete the build folder of project and test building android project with any other version of build-tools.
in my case, build-tools version: 26.0.2 had problem, I tested with 27.0.3 and it solved my problem unbelievably :)
I ran into the same problem, and it turned out I had messed up the file permissions inside the android-sdk folder (more specifically android-sdk/build-tools/{version}), and some binaries were missing execution permissions.
In my case, I simply gave x permissions to the relevant files in that directory, but if you're not sure, I suggest you uninstall the android sdk, completely remove its directory and then reinstall it again.
So after investigating the issue for long , I have a concrete solution .
Let`s look into it.
Go to Android Studio -> Help -> Show Log In Files
In the subsequent folder that opens, open idea.log
This would present you with a log file which contains logs of processes right from when the studio started. Now in this file, you have to search for the possible issue. For some the issue might be due to
java.io.IOException: Cannot run program "/home/mmt/Android-Sdk/android-sdk-linux_x86/emulator/emulator-check": error=13, Permission denied
For some others, it may be some other. The point is that this file contains lot of irrelevant logs and you have to identify the one that is causing this issue. For me , after discovering the above issue, I granted permission to that particular folder using the below commands
cd $ANDROID_HOME/sudo chmod -R 777 emulator/
After this, rebuild your project and tadaaa.. problem resolved.
for me it was a virus that corrupted my files from the "build tools" folder. so I uninstalled everything and made a new installation of android studio, SDK and build tools.
For me, this is the side effect of another issue that I haven't root caused yet. Every once in a while, I get aapt2 failures because some file /tmp/ld-linux-x86-64.so.2 is "busy", with the following error message.
AAPT err(Facade for 1745790725): cp: cannot create regular file '/tmp/ld-linux-x86-64.so.2': Text file busy
Slave 1745790725 failed to start java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at ~/.../android-sdk-linux/build-tools/27.0.3/aapt2) are not corrupted.
When this happens I just rm that file and everything starts working again. I suspect this might be caused by me actually having two installs of adb (one through ubuntu via apt and one from Android studio) but I haven't had time to dive deeper.
I already had latest version of build-tool installed, so I just had to give permission to Android_home:
chmod 777 -R $ANDROID_HOME
and build again. This worked for me.
If you are on Windows 10 (sigh), close android studio and then right click on android studio icon and select 'Run as Administrator' from 'more' menu.
Build again.
You can run Android Studio as Admin.
I hope it will help you.
To Do So :
Right click
choose Run as Administrator
Best regards,
I can get root access to phone using 'adb root' in my PC then change a file content under /data folder. Now I want to do it in a apk using Java code.
I tried blow code:
Runtime.getRuntime().exec(new String[]{"sh", "/sdcard/my.sh"});
This function works well when shell command do not need a root permission.
Now I change my.sh into
su root
chmod 777 /data/filetochange.xml
rm -r /data/filetochange.xml
But it didn't work. Can I do this in Java code?
I think your app need have root permission. You can try to add a line 'android:sharedUserId="android.uid.system"' to AndroidManifest.xml, which property can get system permission. But this is not enough, you need to do other steps and you can google it, there are many detailed tutorials online.