与旧的API对设备进行调试时,机器人工作室展示来源从compileSdkVersion的API机器人、来源、工作室、设备

2023-09-03 22:16:32 作者:海枯石烂 与我无关

我调试了Android工作室(AS)1.0.2与compileSdkVersion 21设在build.gradle。 当使用仿真器API 21一切工作正常。 有19 API的设备上进行调试时,会出现问题。 在调用堆栈中的每一行(标记为框架中,AS)正确地表明,匹配19 API函数名,源文件和行号。 然而,当我点击与框架来源之一(例如Activity.java)对应的线中的一条,AS错误地打开,并显示该API 21版本的文件,而不是在API 19版本

I am debugging with Android Studio (A.S) 1.0.2 with compileSdkVersion 21 set up in build.gradle. When using an emulator with API 21 everything works fine. The problem occurs when debugging on a device having API 19. Each line in the call stack (tagged as 'Frames' in A.S) correctly shows the function name, source file and line number that matches API 19. However, when I click on one of the lines that corresponds with one of the framework sources (e.g. Activity.java), A.S incorrectly opens up and displays the API 21 version of the file rather than the API 19 version.

在我的Andr​​oid SDK文件夹我都 ./sources/android-19和./sources/android-21

In my android sdk folder I have both ./sources/android-19 and ./sources/android-21

任何想法,为什么AS显示错误版本的文件?

Any idea why A.S displays the wrong version of the file?

东西我试过(按顺序):

Things I tried (in order):

重置Android的工作室(删除〜/ .AndroidStudio *) 更新的Andr​​oid工作室为最新版本 与21 API上运行模拟器 - AS显示文件的正确版本(21) 更改compileSdkVersion至19日和API运行19设备 - AS显示调用堆栈正确的行号,并打开该文件在正确路线的正确版本(API 19) 更改compileSdkVersion至19日和API运行21模拟器 - AS显示,在调用堆栈,对应的API 21(这在我看来是正确的行为)的行号,然而,在其上点击时,AS误打开了19 API版本的文件,而不是API 21版。

要总结,在调用堆栈的线路点击时为打开该文件重新$ P $由compileSdkVersion psented,而不是在调试会话期间所使用的设备/仿真器的一个版本。

To summarize, when clicking on a line in the call stack A.S opens up the version of the file represented by compileSdkVersion and not the one used by the device/emulator during the debug session.

推荐答案

在打开的IntelliJ IDEA(机器人工作室的基础上的话)你的项目,选择文件 - >项目结构... 。在项目设置中选择项目的SDK来,你需要调试版本,并选择所有的项目模块项目的SDK作为模块SDK。之后,你可以将调试连接到您的设备/仿真器,看到合适的Andr​​oid源代码。

Open your project in Intellij Idea (Android Studio based on it) and choose File -> Project Structure.... In project setting select "project SDK" to version which you need debug and select for all project modules "project SDK" as module SDK. After that you can attach debug connection to your device/emulator and see proper Android source.

您不必在IntelliJ IDEA的建设项目。

You don't need to build project in Intellij Idea.