How to keep methods collapsed in Android Studio? - java

I have a project which contains 15 classes. If I collapse the methods and restart Android Studio, everything works fine but if I sync the build.gradle file and restart Android Studio again, the methods from some classes are not collapsed anymore. This is happening not in all classes in my project just in those that are not opened. So, let's say I'm working on 5 classes and 10 are closed, it I sync the build.gradle file, the 5 opened classes are ok but the rest of 10 are not.
How to always keep methods collapsed in Android Studio, even if I sync the build.gradle file?
Thanks!

You can modify the configuration of Android Studio for this. Check below:
Environment:
Android Studio 3.1.3
Build #AI-173.4819257, built on June 5, 2018
JRE: 1.8.0_152-release-1024-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.13.4
Go to Preferences > Editor > General > Code Folding and check all the check boxes you want and click apply:
I hope it will work.

Related

Duplicate OpenJDK Platform binary appear in Task Manager when using Android Studio (Windows 10)

Everytime when I open Android Studio, I notice that there two OpenJDK Platform binary running. They are eatting up my PC's memory. As you can see:
I am wondering whether this is normal? Or do I need to configure something?
Project SDK setting:
In Gradle Settings, I notice that in the Gralde JDK drop down list, there are many places JDK installed. Which one should I select?

Android Studio - Not recognizing syntax errors

I've tried to Invalidate Caches/Restart and Clean Project several times.
I'm running the following version of Android studio.
Android Studio 3.2.1
Build #AI-181.5540.7.32.5056338, built on October 8, 2018
JRE: 1.8.0_152-release-1136-b06 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6
The issue is the code is not being autocorrected by the IDE and none of the code assist features are working.
I left some intentional errors in my code and the compiler did not output any errors.
I'm also getting this error whenever I open a project:
Error while indexing /Users/christopherholmes/AndroidStudioProjects/QuizTwo/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/com/example/christopherholmes/quiztwo/R.java
Not sure what to make of this.
EDIT
So I closed and re-opened Android Studio like 3 times and now things are back to normal. Crossing fingers... I will update if I run into any more issues.
EDIT
The problem has returned. To attempt to solve the problem I have
1) Upgraded Android Studio
2) Invalidated and Cleaned Cache
3) Rebuilt the project
I think you should check your directory of adb. It is important to fill correct directory for studio otherwise it will create problem.
The directory will look like../Users//Library/Android/sdk/platform-tools..This is default directory.Make sure your adb is located in that directory.

How to set eclipse for android development?

I just downloaded java JDK 8 and set the environment variables for JDK and JRE, downloaded android SDK extracted them directly to C: (there were no platform tools so I used the command line to download them) and also set the environment variables. And I downloaded eclipse oxygen and I installed new software for ADT Plugin. When I set preferences I referred to the SDK folder and hit apply but nothing seems to happen like no SDK targets are listed. Hhuhuhuhuhuhuhu T^T I have deleted everything from Java, SDK, eclipse and downloaded them all again while disabling my antivirus but that didn't fix it. I also cant open my Android SDK Manager using eclipse, like it shows that it's loading but after that nothing happens even if I wait for 10 mins nothing shows up on screen, not even the command line that seems to just flash briefly which is what most people are having problems with when I search google. Can someone please tell me what to do?? I'm mainly using eclipse for android projects in school
By the end of 2015, Google ended the development and official support for the Android Developer Tools (ADT) in Eclipse.
As stated by Google, every app development project should be migrated to Android Studio.
So you should migrate your eclipse project to android studio.

Android Studio setup JDK error

In Android Studio I am facing bellow error
This popup shows when I press Alt+Enter for missing classes(symbols). When I click on setup SDK it shows two options
1.8(Java version "1.8.0_60")
Android API 23 Platform (Java version "1.8.0_60")
Nothing happens on selecting any of above options.
NOTE: My Java_Home path is correct and in android studio I have checked JDK path it's correct.
I am using Android Studio 1.5.0, Java 1.8 and windows 10
Simple Invalidate Cache and Restart doesn't work for me. So I have done following steps:
Check and verify Java path in Java_home variable
Start Android Studio and invalidate cache File--> Invalidate Cache and Restart
Start Android Studio and click File -> Invalidate Cache and Restart.
This has worked for me. Thanks
Well... In my case, setting up JDK in Project Structure didn't work. Invalidating and restart didn't work either. On further debugging, it led me to this:
Can-t-start-Intellij-after-update
Background of this problem:
I had installed Android Studio 3.6 and upgraded to Android Studio 4. Plugins like Mateial theme, Flutter, CSV viewer, JSON viewer etc weren't compatible with Android Studio 4. So I had disregarded those plugins after I upgraded to AS 4.
After some days, I got a notification that plugins which I had disregarded earlier were compatible with AS 4. So I installed those and restarted AS 4 and applied Material theme. I started to face problems like Set up JDK even though the path to JDK was proper.
So I closed AS 4, deleted caches from .gradle, .android, .AndroidStudio4.0\system\caches. Then I opened AS 4 and set up JDK error was gone.
Hope it helps...
P.S: If same problem persists, then I'm afraid that you've to unistall AS and download AS 4 directly and install it. I still can't figure out why it happened to me...
Close Android studio then again open it .
Go to File--> Invalidate Cache and Restart .
You are done.

Unable to create Android Virtual Device

For some reason, the OK button is not clickable when I try to create an AVD. Does anyone know what I'm doing wrong?
Simply because CPU/ABI says "No system images installed for this target". You need to install system images.
In the Android SDK Manager check that you have installed "ARM EABI v7a System Image" (for each Android version from 4.0 and on you have to install a system image to be able to run a virtual device)
In your case only ARM system image exsits (Android 4.2). If you were running an older version, Intel has provided System Images (Intel x86 ATOM). You can check on the internet to see the comparison in performance between both.
In my case (see image below) I haven't installed a System Image for Android 4.2, whereas I have installed ARM and Intel System Images for 4.1.2
As long as I don't install the 4.2 System Image I would have the same problem as you.
UPDATE : This recent article Speeding Up the Android Emaulator on Intel Architectures explains how to use/install correctly the intel system images to speed up the emulator.
EDIT/FOLLOW UP
What I show in the picture is for Android 4.2, as it was the original question, but is true for every versions of Android.
Of course (as #RedPlanet said), if you are developing for MIPS CPU devices you have to install the "MIPS System Image".
Finally, as #SeanJA said, you have to restart eclipse to see the new installed images. But for me, I always restart a software which I updated to be sure it takes into account all the modifications, and I assume it is a good practice to do so.
Had to restart the Eclipse after completing the installation of ARM EABI v7a system image.
This can happen when:
You have multiple copies of the Android SDK installed on your machine.
You may be updating the available images and devices for one
copy of the Android SDK, and trying to debug or run your application in another.
If you're using Eclipse, take a look at your "Preferences | Android
| SDK Location". Make sure it's the path you expect. If not, change
the path to point to where you think the Android SDK is installed.
You don't have an Android device setup in your emulator as detailed in other answers on this page.
For Ubuntu and running android-studio run to install the packages (these are not installed by default):
android update sdk
I had the same problem while creating AVD with 4.2.2 images, I resolved it by doing the following :
Check if there exist a "default" folder in adt-bundle-windows-x86_64-20131030\sdk\system-images\android-17.
If it exists then move the contents(downloaded system images) of the "default" folder to
adt-bundle-windows-x86_64-20131030\sdk\system-images\android-17.
Hope this helps.
I want to update this question with a screenshot of a recent Android Studio. It took a bit of poking around to find where to install new system images.
You get to the SDK Manager through one of two paths.
Option 1. Tools > Android > SDK Manager
Option 2. Android Studio > Preferences > Appearance & Behavior > System Settings > Android SDK (This is for Mac; adapt for others.)
In the pane "SDK Platforms," check the "Show Packages" box to see the system images.
Select the ones you want, click "Apply" and voilĂ !
I had to move the folders inside a folder named "default" to the android-## folder so Eclipse could see the images.
There is a new possible error for this one related to the latest Android Wear technology. I was trying to get an emulator started for the wear SDK in preparation for next week. The API level only supports it in the latest build of 4.4.2 KitKat.
So if you are using something such as the wearable, it starts the default off still in Eclipse as 2.3.3 Gingerbread. Be sure that your target matches the lowest possible supported target. For the wearables its the latest 19 KitKat.

Categories

Resources