Can't make a project in Android Studio - android

I installed Android Studio 2.1.2.0v and when I want to make a project, have a problem.
Every thing about JDK is right.

Might due to proxy gradle couldn't download it's latest build files, there must be some connection issue you can alternatively do is get sdk from somewhere and in offline mode at least open one project, after it you can update all things and if problem occurs you can easily find solution as android studio clearly shows what are the problems behind these kinda of problems.
It can also happen due to antivirus sometimes,
Recommended reading : https://medium.com/#cesarmcferreira/speeding-up-gradle-builds-619c442113cb#.8h6wyo50c
https://stackoverflow.com/a/27171878/5476209
https://stackoverflow.com/a/21815505/5476209

Related

Android app not running after splash screen

I would like to contact you with the problem that I switched from Delphi version 10.4 to Alexandria (11.2).
From then on, my Android applications compile and build without error, but after the splash screen they do not start on Android devices, regardless of the Android version. Not even on those that ran without errors before.
I did not change the source code, only the development tool was updated.
Looking around the Internet, others are also complaining about this phenomenon, but I can't find a solution anywhere.
My respectful request would be that if you can suggest some kind of solution, please let me know, because this is why I am standing still and it would be good to move forward.
Thank you in advance for your answers.
Android system libraries have been reset to default.
There are a lot of possibilities. Here are a few steps you can use to troubleshoot this sort of failure.
Always back up your project first. Preferably using source control!
Revert Deployment
In the release notes for 11 Alexandria there is section about updates to the Android Manifest
An older Android Project Might Fail at Run Time or When Debugging
Building an older Android project in the IDE can cause the app to fail
at run time and debug time, with a Java "Class not found error". To
correct the issue, do the following:
Select Project > Deployment.
In the Deployment Manager, click the Revert To Default speed button.
It is the 7th button that looks kind of like "undo". Make sure you select the Android platform.
Test a New Project
Create a new simple project from scratch and see if it will run. Try both Android 32-bit and 64-bit. If it doesn't then there may be something wrong in your SDK Manager (Tools -> Options -> Deployment -> SDK Manager).
Look under Android on all three tabs: SDK, NDK, Java; for any warning symbols. You might need to correct a path or install Android support.
Compare AndroidManifest.template.xml
Take the AndroidManifest.template.xml from the new project you created, and compare it to the one in your project from a previous version. If you haven't modified it then you can just copy the new one over the old one.
Revert Android Libraries
Expand out the Project Manager and the Android platforms to Libraries. Right click and choose Revert System Files to Default.
More Debugging
You can use ADB LOGCAT to see the error on failure. This is super useful. There are GUI wrappers for it, like DeviceLens by Dave Nottage of DelphiWorlds.
Check the code in your form constructor. An exception here can cause a crash like you are describing.
Reboot your phone. I hate how often this fixes things for me. It should be the first thing, but it is usually the last.

Android Studio problem with compiling "The process cannot access the file because it is being used by another process."

I know this question has been asked before, but there wasn't a satisfactory answer, and the last post was three years ago.
I am using android studio 3.6.2 in windows 10. Every time I try to compile my program I get the error
"The process cannot access the file because it is being used by another process."
Now I know what is causing the error. The R.jar file that was previously compiled cannot be deleted because android studio is locking the file.
It is in a folder \app\build\intermediates\compile_and_runtime_not_namespaced_r_class_jar\debug
Now to get around the problem I have been closing down android studio. Then deleting the R.jar, then restarting android studio and then compiling.
This process takes a good few minutes and I have to do it every time. Imagine how long it takes to write a program when you have to do this every time.
When this was asked on stack overflow previously suggestions were to Invalid caches / restart, but that is no quicker than what I did above, and only works once.
Also tried Clean Project, but that has no effect.
I have used many compilers over the years like visual studio, codeblocks etc but this kind of thing never happened before, so why is android studio so bad?
Has anyone found a solution to this problem yet?
[][]
Go to Edit Configurations check that you are not building before each launch. Remove "Build"
I also encountered the same problem in Android Studio 4.x in Windows 10. Simply using "Restart and Invalidate" does not work for me. Sometimes, deleting the build folder will work but I cannot build the project more than once. Here is my solution:
Check Java Runtime Version Used by Gradle and System Default
Having multiple daemons may cause problems as described in documentation from Gradle. To solve this problem,
Open your project in Android Studio
Find the JDK location used in your project (File > Project Structure > SDK Location > JDK Location)
Open a command prompt. Let $ANDROID_JDK be the path you found in Step 2. Type $ANDROID_JDK/bin/java.exe --version to find out the Java version.
Type java.exe --version to find out the default Java version used by the system.
Compare if the version information from Step 3 and Step 4 are the same.
Build with app Configuration
Empty Composable Activity template will create two build configurations.
You should change the build configuration to app as shown in the figure below. This solves my problem.
Proper Launching Procedure
As illustrated in Bilal Aslam's solution, we can edit the build configurations (Run > Edit Configurations). After selecting Compose Preview > Default Preview, you will see Build then Gradle-aware Make in the Before launch panel. Remove Build should be able to solve the problem. The side-effects are unclear.

Android Studio hangs at fetching documentation

Recently I experienced that Android Studio is hanging a lot. Right in the middle of typing in any editor it will hang and block me from doing anything else for a couple of seconds. Restarting or killing adb wouldn't help.
After a while I realized that this happens if the documentation is being loaded and displayed. This happens mostly for Android documentation, which is quite verbose and also seems to contain images and formatting.
I already tried switching off the Auto-update from source option, but that doesn't change anything.
Any ideas what could cause Android Studio to block while it's loading or displaying (or doing whatever with) the documentation?
I'm using Android Studio 2.1.1, the latest build with the security fix.
you can check this solution: https://stackoverflow.com/a/26149069/2133585
Here's what fixed it for me:
Make sure you have the Documentation package downloaded in SDK Manager.
Exit Studio if it's running.
Delete the file named "jdk.table.xml" located in ~/.AndroidStudioX.Y/config/options/ (remember to take a backup
first!).
Relaunch Android Studio. should work correctly now and it should regenerate the file automatically.
Note:
This worked for me on Ubuntu 14.04 & Android Studio 0.8.11 (EDIT: Several users are reporting this solution also works for
newer versions of Android Studio).
If it still doesn't work, try deleting and re-downloading the Documentation package from inside Android SDK Manager then try the
above steps.
If you're running Windows, the file is located at "%UserProfile%.AndroidStudio\config\options", and if you're running
OS X, it's located at "~/Library/Preferences/AndroidStudio/options"
(credits to #Gero and #Alex Lipov).
Fix still works for AS 2.2.3 and MacOS 10.12.2 Sierra

Can't create Android Application Project in Eclipse

I have a problem with creating Android Application project in Eclipse on my Mac. When I start Android Application Project Wizard after clicking "finish" in the last step, this window appears:
I've been trying to solve this for hours, but none of the solutions I've found on the internet worked for me (including this). I didn't try to reinstall eclipse itself, but to I don't want to do this. What's the solution to my problem.
UPDATE:
I removed Eclipse and sdk from my computer and downloaded the whole ADT Bundle from here and switched workspace but actually I am still getting the same Errors.
What I found up on the internet was that you could have upgraded your java. So this occurred. The solution to this problem for Mac is to edit the Eclipse.ini file to use java 1.6 .The code Below will work :
-vm/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Commands/java
Start with a clean slate. Unistall Eclipse and redownload - Eclipse is a very big program and can be very buggy at times for no reason. While it is not the quickest solution, ensuring that Eclipse was properly downloaded and installed will provide a good foundation for the future development of you Android applications. Did you install Eclipse just for Android, or did you have a pre-existing copy and want to install the Android SDK?

Eclipse/Android can't generate R files for any project

I am a new Android developer (4 weeks into porting my iPhone app to Android). I have 8 projects (the app, and 6 small UI experiments, and a vanilla Hello World project that I just created with Eclipse). All fail to compile, and the issue is that every reference to the generated file R is flagged as "R cannot be resolved to a variable".
Up until yesterday afternoon -- every project compiled and ran (albeit very slowly) in the Android emulator. I've changed something, and since yesterday, all projects fail to compile, all in the exact same manner "R cannot be resolved to a variable". I every case, the generated files are missing. I believe they disappeared as I tried to clean and rebuild each project in the course of debugging this problem.
Two things that I know changed when this problem started, but that I can't say caused the problem, were: 1) shifting to debugging on a real Android device (a Samsung Galaxy Tab 2, which worked like a champ after struggling with the slow emulators), and 2) allowing Android (and perhaps Eclipse) to update themselves from the web.
I've spent many hours trying other user's suggestions and none have helped. Most suggestions refer to file naming issues, xml syntax errors, but I haven't changed these files and filenames since compilation was working. I have tried:
cleaning and rebuilding the projects
checking for subsequent updates to the Android SDK (and there were 2 subsequent ones)
Eclipse->File->Android Tools->Fix Project Properties
making small source changes to force rebuilding
rebooting Eclipse, as well as the Mac host, adb, the emulator, the Android SDK Manager
deleting a project, restarting Eclipse, and adding the project back in (bad idea - this fails with an error "Failed to load properties file for project 'ListViewFragmentTest'"
creating a brand new Android App project, which has worked many times before, but now fails
There's something going systematically wrong, and while I won't claim all these projects are bug-free, they did run up until 6pm yesterday, and then all stopped compiling thereafter.
I wonder if anyone has other suggestions, before I embarking with a complete reinstall of the development environment?
My environment is:
Macbook Pro (OS X 10.7.5, 8GB RAM, 2.53GHx Core i5)
Eclipse (Indigo Service Release 2, Build: 20120216-1857) (too old?)
Android SDK Manager Rev 22
Android SDK Tools (22), Platform Tools (17), Build Tools (17)
API's 11-17, all up-to-date
Seems like lots of people experience trouble with missing generated files (R), and I have had trouble when I've had layout XML errors as well, but that doesn't seem to be causing this problem. Thanks in advance for your help!
I am not sure but you are facing issue of R.java file is not getting generated after updated with ADT rev 22.
If this is the case then here is the solution:
Hope you know Android studio has gradle building tool. Same as in eclipse they have given new component in the Tools folder called Android SDK Build-tools that needs to be installed. Open the Android SDK Manager, select the newly added build tools, install it, restart the SDK Manager after the update.
Check in the Java build path library, whether "src" check box is checked or not.
If you are using any additional Libraries then make sure libs/android-support-v4.jar is same for project as well as the Libraries.
Thanks everyone. None of these suggestions resolved my problem. And while I'm curious as to why it happened, I was more impatient with not making any progress. I've reloaded Eclipse and the Android tools (this time with the bundled version from developer.android.com), and everything is working smoothly again.

Categories

Resources