Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio not showing java class source

I've searched this question and tried the proposed solutions with no success. I have a project which when I go to view the source file for lets say Fragment it takes me to the java class just fine.

Now when I go to File -> new project and go through all the same set up procedure. Now when I click the source for Fragment I am taken to the decompile class file.

My new project is SDK 28 and i've performed updates, but they don't change anything. By setting my compileSDKVersion to 27 and adjusting the dependencies accordingly, it works. But it should just work with SDK 28 and I don't understand what im missing

In the photo below you can see I have the sources for API28 installed

SDK Manager

Also when I click the Download Sources option below, I receive the following IDE error

Fragment Class

java.util.NoSuchElementException
at java.util.Collections$EmptyIterator.next(Collections.java:4189)
at org.jetbrains.plugins.gradle.util.GradleAttachSourcesProvider.getSourceFile(GradleAttachSourcesProvider.java:160)
at org.jetbrains.plugins.gradle.util.GradleAttachSourcesProvider.access$100(GradleAttachSourcesProvider.java:59)
at org.jetbrains.plugins.gradle.util.GradleAttachSourcesProvider$1$1.onSuccess(GradleAttachSourcesProvider.java:126)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$7.execute(ExternalSystemUtil.java:876)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$9.run(ExternalSystemUtil.java:905)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:713)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:543)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:488)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:94)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:165)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:315)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

My gradle file has the correct SDK set and you can see the .jar folders in the external libraries section of the project structure

external libraries

but when I click source all I see is Decompile Class!!

like image 943
Kyle Avatar asked Sep 02 '18 20:09

Kyle


People also ask

Where is Android Studio source code?

The Studio Source Code In IntelliJ, open the Android Studio project by choosing Open Project and selecting the folder tools/idea/ .

Can I use Android Studio as Java IDE?

The short answer to this is : Yes you can. Look over this slackoverflow post: Can Android Studio be used to run standard Java projects? Android Studio IDE is based on IntelliJ, but with some specific plugins added for Android Development.


1 Answers

I'm gonna chalk this up to Google not yet releasing Android P source code, since when I change my SDK to 27, there is no problem and I have un/reinstalled SDK Platform 28 multiple times. I'll try again in a couple weeks and check if it has been released, until then I can continue my project with API 27.

Thanks!

like image 128
Kyle Avatar answered Oct 03 '22 06:10

Kyle