Getting started with Android code samples - permissions error - android

New to android. Running Eclipse on Ubuntu 9.10 with Android SDK plugin installed and working. Trying to get some code samples from http://developer.android.com/resources/samples/get.html , and following its procedure to load said samples in Eclipse yields:
Parent of resource: /home/user/android-sdk/platforms/android-4/samples/Notepad/.project is marked as read-only.
chmod is not recursive, so I entered ~/android-sdk/platforms and "chmod 777 *" ie. all folders in /platforms. Still doesnt work. Appears to be be a bug in Eclipse that wants to create the project in the SDK folder rather than under ~/workspace.

This is an old thread, but still an issue with the newest release of ADT.
To get around the issue and avoiding having to chmod the entire sdk platform, you can just change ownership of the project itself to your profile instead of the default root profile it is set to.
if you issue:
sudo chmod -R yourProfileName YourProjectDir/
Where yourProfileName is your user profile name, it should resolve the issue. If you are unsure what your profile name is, it is usually the name of your home directory in OSX. In windows, you should be able to find it somewhere under control panel -> profiles.

The far better solution is to select a choice such as "copy into workspace" when creating/importing the Eclipse project.
This has the benefit of leaving the original source files in a clean state, where you can easily refer back to them if your modifications to an example break it.

Whoops. Chmod does have a recursive functionality (of course):
chmod 777 android-sdk -R
but that seems to have borked the Eclipse workspace.

Related

Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user

Thanks you for your time. I really try to complete de configuration of my flutter app for upload to the playstore , but i have this problem when i try execute "flutter clean" like a step in the guide (https://docs.flutter.dev/deployment/android#create-an-upload-keystore):
"Flutter failed to delete a directory at "build". The flutter tool cannot access the file or directory."
"Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user."
I have tried deleting android studio folders and I have not been successful.
I have tried : Windows Security ->Virus & threat protection ->Manage settings ->Controlled folder access ->Turn off Controlled folder access
Bye :D
My problem was importing a project from Windows. I compared the imported folder with one that was created on MacOS and the difference was that appeared extended attribute. So my solution was to remove the extended attributes via command line:
$ sudo xattr -c -r <project_folder>

Android SDK component failed to install

while installing Android studio SDK in ubuntu 14.04, 64 bit using the wizard; I encountered this error
The following SDK components were not installed: sys-img-x86-addon-google_apis-google-21 and tools
It occurred during "Downloading Google APIs Intel x86 Atom System Image, API 21, revision3"
Can someone please help me where the possible error is.
This solution helped me on Ubuntu 20.04 when I already installed the AS, but couldnt install packages in AVD Manager when I wanted to create a virtual device for the emulator, getting a very similar error. Maybe this will help in your case:
Delete the .downloadIntermediates/ directory from your SDK location /.../Android/Sdk/ (usually the path starts in your home folder).
From what I understood, this folder contains logs for your downloads,
and if something goes wrong, this can stop AS from
resuming/downloading new things properly. Don't worry about deleting,
this folder will recreate itself automatically and it doesnt affect
the program
How to delete it via the console:
Open your terminal, go to your sdk folder, if it's a default location in home folder the command is as follows:
cd Android/Sdk
Then check if the folder ".downloadIntermediates/" exists. Run this command and look for it in the list:
ls -la
If it's there, then proceed with removing it:
rm -r .downloadIntermediates
Now you can run the "ls -la" again to see if it is removed successfully.
Launch Android Studio again. Now try installing all the packages you need, they should install with no errors. Hope this helps in your case! :) And in any case, if nothing else works, an uninstall and clean install can be a good idea.

Eclipse hangs at the Android SDK Content Loader

I've been working with Eclipse 4.2 (Juno release 20120920-0800) on OS X 10.8.2 for a few weeks now, building apps for Android 3.0 and above. I have a quad core i7 MacBook Pro with an SSD, so performance is not an issue. Everything was fine.
At some point I imported an Android project that required Android 2.2, so I installed that using the Android SDK manager (v.21). Ever since then, working with Eclipse takes forever. First of all, it will print the following in the status message at the bottom right:
Android SDK Content Loader: (0%)
This takes two minutes or so. The specific message is "Check Projects" and while it's doing that, all Android projects are highlighted in red, because the Android resources aren't found. Then, it proceeds with:
Loading data for Android 2.2 (100%)
This will stay for a couple of minutes. Then it goes on to do the same with Android 3.1 and other SDK versions I have installed. It basically hangs whenever the first autocompletion kicks in (e.g. after typing System.) or when I access the Android preferences before it has loaded.
Here's the state of my Android SDK:
What I've already tried:
Reinstalling the Android SDK (via Homebrew), thus deleting /usr/local/Cellar/android-sdk completely.
Reinstalling the AVD plugin (v.21) from scratch.
What can I do to find out about the source of these problems and get back to a nice and clean state?
This is the solution I found which works correctly:
Make sure that eclipse is not active. If it is active kill eclipse from the processes tab of the task manager
Open %USERPROFILE%/ on Windows or simply ~ on Linux/OS X (You can locate this folder from the Desktop)
Go to .android folder (This may be a hidden folder)
Delete the folder cache which is located inside .android folder
Delete the file ddms.cfg which is located inside .android folder
Start Eclipse
Hope that this will work for you.
Same problem, stuck at 0%. Ran
/Applications/eclipse/eclipse -clean
and everything worked great again. Modify that path for linux boxes.
Update (from the remark from #Janusz )
For mac users with eclipse outside application directory your clean command will looks similar to:
path/eclipse/Eclipse.app/Contents/MacOS/eclipse -clean
Go to your workspace directory \workspace\.metadata\.plugins\org.eclipse.core.resources\.projects and delete all the projects in there.
Note: You are not going to lose your projects
I have used some other answers here to fix this problem but I came across it again recently, and none worked. I didn't want to re-install or delete my workspace, so I finally found one that did work that might help someone else. Delete the file:
/workspace/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi
You can make a backup first, if you like. It stores your workbench settings (perspective state, file paths for menu options, etc.) But eclipse loaded and I didn't have to re-install anything like some answer suggest. And I haven't seen this anywhere.
I know that this has been resolved but I thought I would share this link:
Solution One
Often times, this problem can be network related. Check if your
network is behind a proxy. If so, you need to configure proxy
on Eclipse. For that, go to “Windows” -> “Preferences” -> “General” ->
“Network Connections”, and fill in your proxy info. Restart Eclipse
after that. Conversely, it’s also possible that you have configured
proxy on Eclipse before, but that you are no longer behind proxy. Make
sure to disable proxy then.
Solution Two
Another solution is to clean up project-specific meta data directories
which are stored under your workspace directory.
$ cd workspace/.metadata/.plugins/org.eclipse.core.resources/.projects
$ rm -rf *
Restart Eclipse.
Solution Three
Check if an adb process is running. If so, kill the adb process, and
restart Eclipse.
Solution Four
Try deleteing the contents of the cache folder located in user profile under .android\cache
Try deleteing the ddms.cfg located in user profile under .android
All the other solutions did not work for me so I simply deleted all the .log files inside the folder [workspace]/.metadata and it worked again!
It turns out this problem indeed occurs when your internet connection is flaky, slow, etc.
As soon as I got back to my normal internet connection, the content would load fine again, within less than a few seconds.
I have tried all the solution but i didn't get solution. After that i have disconnected Internet and deleted ddms.cfg from .android folder -> open eclipse -> dialog of statistics send to Google? -> Selected NO and Finally Worked for Me.
Edited:
I have tried eclipse -clean command in Command Prompt and that also worked for me.
Note: For eclipse -clean command first you have to select path of
eclipse folder where you have placed.
Thanks.
I'm on a Mac and using ADT, can confirm that the following worked for me.
cd workspace/.metadata/.plugins/org.eclipse.core.resources/.projects
rm -rf *
No amount of restarting the Eclipse, or rebooting the Mac was helpful. It seems that Eclipse gets into this stage because of stopping abruptly. I had to force boot my Mac and this issue seems to be happening since then.
My solution:
Install all the Docs in the sdk manager.
I prepared little script to make it easy dealing with this reoccuring and very annoying problem. Open Terminal, then:
open ~/.bash_profile
at the end of the file paste this function:
function eclipse-clean() {
echo "removing ddms.cfg file"
cd ~/.android/
rm ddms.cfg
echo "removing cache"
cd cache/
rm -rf *
echo "done! you can open eclipse now."
}
then all you have to do now is:
source ~/.bash_profile
and whenever you are stuck just type in Terminal window:
eclipse-clean
just right click on eclipse and run it as a administrator i was also having the same problem after this it was working fine actully sometimes the windows do not give the permission to access to sdk in normal user so you have to give admin permissions in order to work android sdk or content loader
this approach:
shut down eclipse then go to YourWorkSpace\.metadata\.plugins\org.eclipse.e4.workbench and remove "workbench.xmi", now restart eclipse.
I made this batch file to fullfill the task explained by slhck's answer for Windows systems:
#echo off
set ECLIPSEFOLDER=%CD%
cd /D %USERPROFILE%/.android
rd /s /q cache
del ddms.cfg /f
cd /D %ECLIPSEFOLDER%
eclipse -clean -refresh
exit
I explained such approach in this post on my blog.
All the above solutions didn't work for me.
In eclipse Under Problems Tab check errors-
You might see the unable to delete file and project path name.
Now Go to your workspace directory -
Check project.properties for all the project stated under problems tab and check
target=android-21
The target value is valid and exists in your android-sdk/platforms/ folder
In my case target=Google,Google-Api-16 was causing the issue. Replace that and it solved.
Worked! All I did was to open Terminal and typed:
cd documents/workspace/.metadata/.plugins
and then... typed
rm -rf
... in that .plugins category.
There are various reasons for this problem, and each have a different solution.
For a Linux environment, I made a alias to take care of most of these as they happened overtime. To have all of those in one place, you could try this:
Add the following in your ~/.bash_aliases file.
alias eclipse='rm -rf ~/.android/ddms.cfg;rm -rf ~/workspace/MyApps/.metadata/.plugins/org.eclipse.core.resources/.projects/*;mv ~/workspace/MyApps/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi ~/workspace/MyApps/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi.bkp;rm -rf ~/.android/cache/;cd ~/Desktop/adt-bundle-linux-x86_64-20140702/eclipse;nohup ./eclipse & cd -;'
Refresh source using source ~/.bash_aliases
Note:
~/workspace/MyApps is my workspace, you'll have to configure your's accordingly.
~/Desktop/adt-bundle-linux-x86_64-20140702/eclipse is the location of my eclipse executable,and you'll have to configure your's accordingly
So this is what got me working again:
Resolved the problems with the different versions related to android-support-v4.jar. They were mismatched which causes problems if projects are related anyway.
The second one is not that obvious: I restarted the IDE from the shell, providing the $ANDROID_SDK_HOME - Environment variable.
This got me a step further but the ide hangs on a different location.
Providing $ANDROID_HOME finally got me all the way up again.
BTW: After this procedure it was not necessary in following starts of the IDE to set the environment variables again.

Updating Android SDK: "A folder failed to be moved."

While trying to update my Android SDK I am encountering this error when trying to install this particular package:
How do I fix this?
This happens once in a while on my Windows SDK (even when I don't have any antivirus or similar programs running, execute the SDK-Manager as an administrator and so on).
I just update the tools by hand in this case. Which means close the SDK-Manager after the error and open the ANDROID_SDK\temp folder. There should be a zip named tools_R16.zip or similar (don't remember the exact name). Unzip that. You should end up with a tools folder. Copy all the files from this folder into ANDROID_SDK\tools. Overwrite when asked. And take a backup of the SDKs tools folder beforehand, just in case something explodes.
After that, start the SDK-Manager again. The tools version should be updated.
The problem seems to be that Eclipse, or even the SDK Manager itself, locks the folder. Running android.bat from the tools folder should do the trick.
If you launched the SDK Manager from Android Studio then all you need to do is close Android Studio.
I presumed the SDK Manager was a modal dialog that was part of Android Studio - not a separate program.
thanks. this is how I fixed it:
I updated the tools by hand in this case. Which means close the SDK-manager after the error and open the folder android-sdk-windows folder. Using LockHunter, unlock all programs from holding a lock on the android-sdk-windows\tools\ folder. http://lockhunter.com/?ver=&vertype=pro&sm=main_window_64
RENAME the android-sdk-windows\tools folder beforehand to tools_DELETEME
There should be a zip named android-sdk-windows\temp\tools_r19-windows.zip. open that, You should see a tools folder in it. Copy that tools folder to android-sdk-windows\tools
After that, start the SDK-manager again. The tools version should be updated.
When you install tools/softwares use SDK manager. But don't use it when update. Do right click -> Run as administrator on android-sdk-windows\tools\android.bat file for updating tools. Always try to run commands as Administrator specially on Windows Vista/7/8. That'll fix most of permission issues etc...
You probably started the SDK manager from eclipse? I encoutnered the same problem, and fixed it by manually opening the SDK manager from the directy tools.
My solution was to start it from within eclipse - as Administrator.
well i had the same issue on windows 7 ... problem is that during the update it tries to rename the tools folder (inside the SDK folder) and that folder is used by a process "ADB" which is currently running ...
so you cannot do the update smoothly until you stop / kill that process ...
BTW copy pasting the new contents of tools folder from the temp would also work ...
With windows 7, when "failed to install popup" appears kill the process called adb (from task manager ctrl+alt+del) then press "Yes" and stuff is being installed.
I tried running android.bat and got the same error.
What worked for me was using unlocker to unlock the \tools folder.
Ensure you don't have any essential files or folder opened/being used by other applications including explorer.
I've read before, people take a copy of the platform-tools folder and run the update from a different location. This ensures you haven't got open the files it's trying to update.
Could also disable your antivirus for 5 minutes o0o0.
On Windows 7 and probably Vista, run Eclipse as administrator.
My problem was Windows 7 security. I opened up the security on C:\Program Files\Android to EVERYONE with FULL access and it then worked. I then removed EVERYONE after the update was complete.
I had to make a copy of the tools folder itself (keeping it at the same directory tree
level, thus "tools" and "tools-copy" were both in the "android-sdk-windows" folder).
Then ran Android.bat from that copy.
After the update just delete the tools-copy folder.
The error message was Failed to rename directory C:\devtools\android-sdk\system-images\android-21\google_apis\x86 to C:\devtools\android-sdk\temp\SystemImagePackage.old01. I deleted the C:\devtools\android-sdk\temp\SystemImagePackage.old01 directory by hand (it was a leftover? I don't know) and it was able to proceed.
Same error i got while updating sdk. It is because of targeted folder locked (access permission is denied).
You can resolve it as follows in "Ubuntu" :-
Press ALT + F2 and type 'gksudo nautilus' and navigate to the targeted folder like tools or extras and give create and delete permission.
then update, every thing will be working fine :)
First make a copy of tools folder in same directory (android-sdk or android-sdk-windows) then delete the original tools folder and then open the android.bat file by double clicking in tools-copy folder to launch sdk manager and install the tools.
If tools folder is not being deleted then use the unlocker LockHunter to delete the folder and then open android.bat to update the tools.
After successful installation of tools delete the tools-copy folder.
Close Eclipse or Android Studio if open.
It worked for me!!!
On my PC it was caused by monitor.exe running in the background. Terminating that proces solved the problem.
Close the currently launched android studio window from task manager by going to the studioprocess (So when closed there are currently no active studio windows). Then go to Android studio in windows explorer, select the studio64/studio(if 32 bit OS) and right click and select run as administrator.
In one line - you need to run Android Studio as a administrator.
These are the steps followed by me.
Restart the computer.
Open "C:\android\androidStudio\sdk\tools\android.bat" as admin.
Now install packages should run fine.
I know this is an old post but I want to write my personal solution to the problem:
Failed to rename directory C:\android-sdk\tools to C:\android-sdk\temp\ToolPackage.old01.
Obviously I have had the same issue and every time the Android tools needs to be updated it's a nightmare.
None of the solutions I found googling the net worked for me up now, but this is a vital job to maintain Android SDK updated. So I started to find an alternative working way to solve this issue and I found it finally.... at least... it works for me, even if it is a bit tricky.
The basic problem is that the android.bat batch file comes from the ~\tools\ folder and it's still in memory (running) while the same ~\tools\ folder needs to be updated (in our case, renamed).
The problem is that the android.bat runs java to launch swt.jar (the SDK tool), and it remains uselessly waiting for completion of this java program.
You can edit the android.bat and see the call in the latest row of this batch:
call "%java_exe% %REMOTE_DEBUG%" "-Dcom.android.sdkmanager.toolsdir=%tools_dir%" "-Dcom.android.sdkmanager.workdir=%work_dir%" -classpath "%jar_path%;%swt_path%\swt.jar" com.android.sdkmanager.Main %*
The problem is the "call" CMD command. It waits for the called external program completion.
But ther's another way to run external programs from a batch file: the "start" command. It launches an external program and terminates.
So I just replaced the "call" command with "start", so that after the change the latest row of my android.bat was:
start "" "%java_exe% %REMOTE_DEBUG%" "-Dcom.android.sdkmanager.toolsdir=%tools_dir%" "-Dcom.android.sdkmanager.workdir=%work_dir%" -classpath "%jar_path%;%swt_path%\swt.jar" com.android.sdkmanager.Main %*
Note: Keep the "" in between start and the application path. You can add text in those hyphens and this text will be the caption of the java.exe command window you will see after the changes. In my case I left the caption as an empty string but you can write there what you want.
After the changes, you can start the SDK and the android.bat will be no more waiting, leaving the SDK tool free to play (and rename the ~\tools\ folder without headaches).
Obviously, after updating the SDK tools, you have to redo the same changes in the new, updated android.bat batch file. This could be a bit unconfortable, but you'll have just to remember to make the changes before running the SDK tool and you'll have no other headaches while updating Android.
In Ubuntu following solved issue for me
cd [tools/directory/path]
sudo ./android
Solved this on my side by killing the adb.exe in Task Manager.
I just stopped the emulator, and problem was solved.

eclipse won't create adt project due to 'access denied'

I installed JavaEE, JDK, Eclipse 3.5.x (Galileo), the Android Starter SDK, and the current ADT all with no problems. However, when I try to walk through the 'Hello Android' tutorial, I bring up the New Android Project wizard, fill it in and hit 'Finish'.
After a moment, it comes back with a message saying there was a problem at path X:\so and so\ (access denied).
Things to note:
-Running Windows 7 Home Premium 64-bit
-Quadcore Pentium with 8GB RAM, 8TB NAS
-I am an Administrator
-I have also tried this by activating the full (hidden) Administrator profile
-I have reinstalled everything 8 or 9 times
-I have changed ownership & permissions all over the place
-I have launched eclipse in 'Run as Administrator' Mode
-I have installed Everything as 32-bit, as others have done this successfully
Eclipse creates the folder it's having a problem with, but then cannot work with the .project file it creates (access denied). It then can't save anything so there is nothing but an empty folder 'Hello_Android' on the left within Eclipse.
Anybody have any clues about what is going on-- I'm frustrated. I want to get into this, and I've looked EVERYWHERE on the net trying to crack this nut.... but I need help.
-J
Hmmm. Interesting.
I would double-check permissions on the folder X:\so and so\ and ensure that the Administrators group and/or your account has full control.
Have you tried creating the project outside of the users or systems environment? You know in c:\myprojects
Windows7 and creating/saving files in program files or documents can be a PITA.
Turned out to be a bug with how eclipse is written. I've developed a workaround.
The problem is that eclipse can't write to hidden files, unhide them and it should work.

Categories

Resources