android studio0.4.2,android studio 0.4.2 + gradle + Android Source cod

本文主要讨论了Android Studio在自动管理IntelliJ SDK时出现的问题:当为特定API级别创建的Android SDK缺少源代码时,即使后来下载了源代码,SDK管理器也无法识别更新。作者已就此问题在Google上提交了bug报告,并提供了两种工作around:一是直接访问隐藏的SDK面板手动添加源代码路径;二是删除Android Studio自动生成的SDK并重新配置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The short explanation is that Android Studio has added some functionality to try to automatically manage IntelliJ SDKs; if you give it a JDK path and Android SDK path in Project Structure > Android SDK, it will automatically create a Java SDK and Android SDKs for each API level you have installed in your Android SDK. The problem is, if it creates an Android SDK for an API level that doesn't have the sources downloaded, if you go into SDK Manager later and download the source, it doesn't pick that up and update its SDK. I've filed https://code.google.com/p/android/issues/detail?id=65230 for this. In that bug I list two workarounds, which I'll explain here:

You can actually get at the SDKs panel you're looking for. We hide it if you have a Gradle-based project open since we want Gradle-based project users to not have to worry about it, but since we also support IntelliJ-style projects that use its internal builder, it's still possible to access it so those users will be able to make their projects work. You can get at this panel if you access Project Structure without a project open. To do so:

Close all open projects

From the Welcome to Android Studio screen, go to Configure > Project Defaults > Project Structure > SDKs

Choose the appropriate Android API SDK that you installed source for, and go to Sourcepath panel

Press the + button, and choose the source directory.

If you're having trouble following that, let me know and I can post screenshots.

Another approach would be to blow away all of Android Studio's auto-created SDKs and let it rebuild them. To do that

Exit Android Studio

Delete the jdk.table.xml file, which on MacOS will be in your home directory under Library/Preferences/AndroidStudioPreview

Relaunch Android Studio

Go into Project Structure (either from the Welcome screen or from a project), and choose the Android SDK tab

Make sure the Android SDK location and JDK location are correct.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值