Android Studio/IntelliJ - Where do I manage the JRE list for unit tests? - android-studio

I must be missing something terribly obvious here: Since some recent Android Studio update/reinstall (I can't remember) I have to manually set the JRE that should be used - otherwise, an invalid path will be used and the test will fail.
Where do I manage this list? I would like to remove all invalid entries and duplicates.

Currently Intellij Idea does not provide a way to remove the list of JRE Entries. You can try the followings.
First uninstall Intellij Idea editor.
Go to the directory C:\Users\ if you are using windows, remove the folder/s like .IdeaIC. or .IdeaIU.
Reinstall Intellij Idea and select the appropriate JDK version.
OR You can do the following.
As per the above screen shot point to you JDK location.
It will solve the problem.

After following #Sambit's hints and looking around some more I found the solution: The list is stored in (in my case) ~/.AndroidStudio3.4/config/options/jdk.table.xml. There, each list item is represented by a <jdk> element. After removing all the unwanted entries and restarting Android Studio (complete restart, not just close/open project) I now have list that looks much nicer:
I have not tried what happens when you mess up the XML structure so take care!

Related

Only partial syntax highlighting in Kotlin script file

I opened a folder in Android Studio which contains a Kotlin script file (.kts). I configured a JDK as SDK in Project Structure (but I added no gradle files), and running the file as Kotlin script works fine. However the syntax highlighting is only PARTIALLY working, see below example (Linux Mint 19.3 and AS 4.1.3):
Some of the stuff missing:
unused variable should be gray (val unused)
to/forEach keyword should be yellow and italic
misspelled variable names should be red
bad style such as extra spaces should be underlined
etc.
What's even going on here? Is this some sort of "fallback" mode?
Any way to use the "full" syntax highlighting from normal Android projects, so I can spot mistakes earlier?
For reference, this is what it "should" look like (pasted into a random Android project):
Renaming the file to end in *.main.kts (scriptname.main.kts) enabled full highlighting for me!
I get this type of issues from time to time with IntelliJ IDEA. I haven't found the reason why it happens, neither do I know the 100% working solution. But here are the options that usually help me solve it:
Restart IDE
Invalidating caches: File > Invalidate Caches...
Re-import the project. Remove the .idea folder and the project.iml file and try to import the project again.
Update the IDE. Last time I had this issue, nothing helped but updating IDEA to 2021.1.
I hope some of these options will help.

How can I fix Microsoft Visual C++ 2017 X64 Minimum Runtime error during installing Redistributable packages (VC_redist.x64.exe, VC_redist.x86.exe)?

During installation I get "The feature you are trying to use is on a network resource that is unavailable" and prompt to specify some path to vc_runtimeMinimum_x64.msi. After providing some path to required file I get error states that this file doesn't match required version Minimum Runtime 14.14.26405.
I finally found the solution reading this question: Install vcredist_x64 with VS2017 installer project
I realized that specific VC_Redist.x64.exe files could be downloaded by links like https://aka.ms/vs/15/release/26405.00/VC_Redist.x64.exe, where 26405.00 is exactly the version I was required to fix. Note, that you need version from error text after clicking OK, not from window title.
And the last point is that this exe must be executed from cmd with argument /repair to help me with this issue. Regular execution by double click made no effect.
I found the solution elsewhere. It said to
Fix problems that block programs from being installed or removed
https://support.microsoft.com/en-us/help/17588/windows-fix-problems-that-block-programs-being-installed-or-removed
download troubleshooter button on the link.
Run it - choose option - have problem with installing - it lists programs - choose the missing / problematic visual c++ runtimes in the list
it will run and get fixed.
Repeat for each visual c++ you having problems with. I ran the program multiple times.
I have to thank this comment section for helping me with this problem, since I have not been able to work more efficently with my school, since I din't know what and if a single file somewhere deep down in the computer had to be deleted for this program to work.

visual layout editor does not allow drag&drop

I'am a newby in android studio and learning a lot, but now have a problem where i cannot seem to find the answer to.
In android studio you can visualy drag&drop your screen.
I have seen it can do al lot (although you sometimes need the xml) but for me it is not working at all.
I mean i cannot drag&drop any widgets on the screen at all.
Tried changing the theme: no help (really tried a lot of them)
Tried a complete new project: same story
Tried other APK verion: same story
Tried Invalidatd caches / restart: no help
Even with a new project (EmptyActivity) it add's a android.support.v4.widget.NestedScrollView and then gives error's on that
(Failed to find style 'coordinatorLayoutStyle' in current theme).
It also gives an error on layout_height/layout_with not being there. But they are there for each widget.
Please do not missunderstand: when i execute the project i runs just fine (both on phone and emulator) but the visual builder for the screen.....:-(
Does somebody knows how to solve this.
If more info is needed please ask.
Any help is more than welcome.
There are several things that could be causing this:
Your caches could be messed up. Try going to
File > Invalidate Caches / Restart ... (I know that you already tried this, but posting for future views.)
Also, make sure that you don't have Drag-n-Drop with ALT pressed only checked in your Settings (Appearance & Behavior - Appearance).
Finally, in a default project created in Android Studio, there are two XML files created for each layout. For example, content_main.xml is embedded within activity_main.xml. Make sure that you are using content_main.xml for your design work.
In the end i fixed it by changing the SDK version in de gradle file.
still do not understand why it was wrong as studio genereded it that way but now it works so.... for me: case closed.

Android Studio 3.1.2 0 - no longer see errors in all files (red underlined)

I feel like I'm going crazy, but since updating to the new version of Android Studio, I can no longer tell which files have errors in them.
Previously, if I made a change in one class, like to a method signature, then all other classes that were calling that method would suddenly be highlighted in red (at that section along the top that shows the path). Now it shows nothing as though my code is good, except when I go to compile, I now get a load of errors in the build tab at the bottom, in a really unhelpful way to navigate through.
Is this something I can switch back to through a setting somewhere? I'm really not sure what to search for, but I've been through almost all of them.
UPDATE :
Following another SO post, I turned on and off PowerSave mode, at the bottom of File menu (in Android Studio). This, temporarily at least, seems to have solved things.
This may be what you are looking for?
Either that or it may be in preferences.

Full package name instead of folder in Android Studio

FIXED IN AS 2.2.1
After update Android Studio to the 2.2 I've got this problem. It's hard to use such format with a small 13-inch display.
In Project view and Android view I get folders name as full packages name but I want to see just names of the directories:
I tried to search for this problem, but I only find "Compact empty middle packages" which impact only for a top level folder.
"Flatten packages" option creates tons of the directories, for every package making everything even worse:
One more screenshot:
In the Package/ Project or Androidview etc, Go to the gear icon on the right side and uncheck Flatten Packages and Compact Empty Middle Packages. This should show you the break down by directory instead of flattening it.
Note: This has now been fixed in Android Studio 2.2.1
AOSP - Issue Tracker:
Project structure view is showing full package names for sub packages when data binding is enabled.
https://code.google.com/p/android/issues/detail?id=222914
Check this configuration if Flatten Packages is not your desired solution:
Hope it will help

Resources