英文:
Android Studio Flamingo Debug Console not working
问题
Recently, I updated my Android Studio to Android Studio Flamingo 2022.2.1. Also, in some projects, I upgraded the AGP dependency from 7.4.2 to 8.0.0.
从那时起,我无法使用调试控制台。控制台屏幕仅显示“打开 Logcat...”和“已连接...”,如下图所示。我在物理和虚拟设备上进行了一些测试,结果都相同。
我认为问题与将 AGP 依赖项从 7.4.2 升级到 8.0.0 无关,因为一些项目仍在使用之前的版本 7.4.2,但调试控制台出现了完全相同的问题。
英文:
Recently I updated my Android Studio to Android Studio Flamingo 2022.2.1. Also, in some projects, I upgrade AGP dependency from 7.4.2 to 8.0.0.
From that point, I am not able to use Debug-Console. The Console screen is showing only "Open Logcat..." and "Connected..." as the image below shows. I did some tests on Physical and Virtual devices with the same result.
I think the problem is not related to the upgrade AGP dependency from 7.4.2 to 8.0.0 because some projects using the previous version 7.4.2 and the Debug-Console has exactly the same issue.
答案1
得分: 3
我在M1 Mac上使用Flamingo,也遇到了调试问题,但与您的问题不同。我的gradle版本是7.3.3。在模拟器和一些物理设备上调试没有问题,但其他一些物理设备无法正常工作。调试会启动,但断点永远不会触发。非常奇怪。回退到Electrical Eel,问题解决了。
英文:
I'm using Flamingo on M1 Mac and I'm also facing debugging issue, but different from yours. My gradle version is 7.3.3. I have no problem debugging on emulators and some of my physical devices, but some other physical devices do not work. Debug will launch, but brake points will never be reached. Super weird. Reverted back to Electrical Eel and problem fixed.
答案2
得分: 1
完整解决方案:
正如Qikai Gao建议的那样,下载Android Studio Electric Eel 2022_1_1 Patch 2。
然而,如果你已经将AGP依赖从7.4.2升级到8.0.0,你必须将版本回退到7.4.2,否则你会遇到多个错误。
将AGP版本回退到7.4.2
1,build.gradle
dependencies {
// classpath 'com.android.tools.build:gradle:8.0.0'
classpath 'com.android.tools.build:gradle:7.4.2'
2,gradle.properties
#android.defaults.buildfeatures.buildconfig=true
#android.nonTransitiveRClass=false
#android.nonFinalResIds=false
3,Gradle.wrapper-properties(Mac)
#distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
英文:
The Full solution:
As Qikai Gao suggests download the Android Studio Electric Eel 2022_1_1 Patch 2.
However, if you already upgrade AGP dependency from 7.4.2 to 8.0.0 you have to revert the version to 7.4.2 otherwise you end up with multiple errors.
Revert AGP to 7.4.2
1, build.gradle
dependencies {
// classpath 'com.android.tools.build:gradle:8.0.0'
classpath 'com.android.tools.build:gradle:7.4.2'
2, gradle.properties
#android.defaults.buildfeatures.buildconfig=true
#android.nonTransitiveRClass=false
#android.nonFinalResIds=false
3, Gradle.wrapper-properties (Mac)
#distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
答案3
得分: 0
尝试点击模拟器链接以转到Logcat或点击Logcat。
英文:
try clicking on the emulator link to go to Logcat or click on Logcat
.
答案4
得分: 0
安装 NDK 修复了我的问题。我追踪到问题出在调试类型的“自动检测”设置上。如果我将其设置为“仅 Java”,就可以正常工作。所以检测一定选择了“双重(Java + Native)”。我安装了 NDK 25.2.9519653,现在可以正常工作了。
英文:
Installing NDK fixed it for me. I tracked it down to the Debugger setting of Detect Automatically for Debug Type being the issue. If I set it to Java Only, it worked fine. So the detection must be selecting Dual (Java + Native). I installed NDK 25.2.9519653 and it is now working.
答案5
得分: 0
我尝试了上面列出的解决方案,但都没有起作用。然后我尝试了"Invalidate Caches"选项,这对我有效。步骤如下:
- 在Android Studio中,转到文件->使缓存失效...
- 会打开“使缓存失效”窗口,选择要清除的缓存类型
- 点击"使失效并重启"按钮。
这将清除缓存并重新启动Android Studio。
后来我在IntelliJ IDEA网站上找到了以下内容,点击“使缓存失效”窗口的帮助按钮:
> 当你使缓存失效时,IntelliJ IDEA会删除当前版本的IDE中所有项目的缓存文件。这些文件将在你下次打开这些项目时重新创建。如果使用IntelliJ IDEA的本地构建器构建项目,IDE还会重新构建这些项目。<br><br>
在继续之前请注意以下事项:<br>
>- 直到你重新启动IntelliJ IDEA之前,缓存不会被删除。<br>
>- 打开和关闭项目而不使缓存失效不会删除任何缓存文件。<br>
>- 除非你在“使缓存失效”对话框中明确启用了此选项,否则使缓存失效时不会删除本地历史记录。但请注意,默认情况下,本地历史记录保留期为5个工作日。
英文:
I tried the solutions listed above, but none of them worked. Then I tried the "Invalidate Caches" option, which worked for me. The steps are as follows:
- In Android Studio go to File->Invalidate Caches...
- Invalidate Caches window will open, select which caches you want to clear
- Click "Invalidate and Restart" button.
This will clear caches and restart the Android Studio.
Later I found below in IntelliJ IDEA site clicking the help button of Invalidate Caches window:
> When you invalidate the cache, IntelliJ IDEA removes the cache files for all projects ever run in the current version of the IDE. The files will be recreated the next time you open these projects. The IDE also rebuilds the projects if they are built with the native IntelliJ IDEA builder.<br><br>
Note the following before you proceed:<br>
>- The caches will not be deleted until you restart IntelliJ IDEA.<br>
>- Opening and closing a project without invalidating the cache does not result in deleting any cached files.<br>
>- Local History is not deleted when you invalidate the cache unless you explicitly enable this option in the Invalidate Caches dialog. However, mind that Local History has a retention period of 5 working days by default.
答案6
得分: 0
你可以原谅对此感到困惑或认为存在错误或配置问题,因为这没有在发布说明或其他典型渠道中向社区传达,但有一个故意的决定来移除Flamingo中的调试控制台功能。
请参见:https://issuetracker.google.com/issues/37137285
在那里的评论中,Android Studio的开发人员表示Logcat现在是查看调试日志的预期方式。
为了保留旧的调试控制台行为的便利性,在“编辑运行/调试配置”中,Logcat可以设置为在应用启动时自动打开。在Logcat筛选框中,使用“package:mine”只查看来自您的应用的日志。
英文:
You can be forgiven for being confused or thinking there's a bug or configuration issue, since this wasn't communicated to the community in release notes or other typical channels, but there was an intentional decision to remove the debug console's functionality in Flamingo.
See: https://issuetracker.google.com/issues/37137285
In the comments there, Android Studio developers say that Logcat is the intended way to view debug logs now.
To preserve the convenience of the old debug consoles behavior, in edit run/debug configurations
Logcat can be set to open automatically at app launch. In the logcat filter box, use package:mine
to view only logs from your app.
答案7
得分: 0
在我的情况下(使用第三方模拟器 Nox Player),在 Flamingo 下,我无法同时调试我的应用程序并使用 Logcat 工作。
所以,如果你正在寻找解决办法,可以尝试切换回旧版 Logcat,方法是取消勾选默认启用的设置->实验性->Logcat->启用新 Logcat 工具窗口标志。
但如果你需要调试你的应用程序,切换回新版 Logcat,然后通过视图->工具窗口->调试来打开调试面板。
这种方法非常不方便,但这解决了我的问题。
如果你使用的是 Android Studio Giraffe,切换到旧版 LogCat 的可能性已经消失。因此,你可以参考ADB 无法连接到 Nox。我发现这个和这个回答对我很有用。
英文:
In my case (using third-party emulator Nox Player) I was not able to debug my apps and to work with Logcat at the same time under Flamingo.
So, if you are looking for that, the one more solution found without any downgrading.
If you need logging your app just switch to old-styled Logcat by unchecking the flag Settings->Experimental->Logcat->Enable new Logcat tool window that is checked by default.
But if you need debuging your app just back to the new-styled Logcat and then open Debug panel by View->Tool Windows->Debug
It is strongly inconvenient way but this solved my issue.
If you are using Android Studio Giraffe there is disappeared the switching to old-styled LogCat possibility. So you may look at ADB can't connect to Nox. I found useful for me of this and this answers.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论