简体   繁体   English

Android Studio,下载soruces android-27以定位最新的SDK

[英]Android Studio, download soruces android-27 to target latest SDK

To start a new project, I want to target the latest SDK (taking advantage of the fresh start). 要开始一个新项目,我想要定位最新的SDK(利用新的开始)。 But, I also want to have access to the Android source code to be able to read the code of android classes (like AsyncTask, just as an example). 但是,我也希望能够访问Android源代码,以便能够读取android类的代码(比如AsyncTask,就像一个例子)。 I'm targeting SDK 27 on gradle and also using compileSdkVersion 27. I've tried by different ways (as indicated here , here and here ) but I can't seem to download those sources. 我针对的gradle上SDK 27也使用compileSdkVersion 27.我已经通过不同的方式尝试(如所指出这里这里这里 ),但我似乎无法下载这些来源。

When I try to browse an Android class like AsyncTask for example, I get the message: 当我尝试浏览像AsyncTask这样的Android类时,我收到消息:

Decompiled .class file, bytecode version: 52.0 (Java 8) 反编译的.class文件,字节码版本:52.0(Java 8)
Sources for 'Android API 27 Platform' not found. 未找到“Android API 27平台”的来源。

Even after clicking the Download and then the Refresh (if already downloaded) links (which is the most intuitive thing to do) I still can't see the source code of any Android class. 即使单击下载然后单击刷新(如果已经下载)链接(这是最直观的事情),我仍然看不到任何Android类的源代码。

This is an issue only for API 27. I'm able to download sources for all other API versions. 这仅是API 27的问题。我可以下载所有其他API版本的源代码。

Is this because of API 27 being the latest one? 这是因为API 27是最新的吗?

I want to avoid targeting 26. Is it possible to download those sources? 我想避免使用目标26.是否可以下载这些来源? Has anyone been able to do it so far? 到目前为止,有没有人能够做到这一点?

If someone knows how to do this so far, that would be very helpful. 如果到目前为止有人知道如何做到这一点,那将非常有帮助。 Thanks. 谢谢。

I'm using Android Studio 3.0 and the download option for API 27 source is not available: 我正在使用Android Studio 3.0,并且API 27源代码的下载选项不可用:

API 27的来源不可用 没有下载源的选项

UPDATE UPDATE

As indicated by the accepted answer, the problem was the API Level 27 being a dev preview back then, the problem got resolved with time (once the official release happened). 正如已接受的答案所示,问题是API级别27是当时的开发预览,问题随着时间的推移得到解决(一旦正式发布发生)。 This update may be useful for people facing similar problems when targeting the latest available API version. 在针对最新的可用API版本时,此更新可能对遇到类似问题的用户有用。

Is this because of API 27 being the latest one? 这是因为API 27是最新的吗?

No, it is because API Level 27 is Android 8.1, which is in a developer preview at the moment. 不,这是因为API Level 27是Android 8.1,目前处于开发者预览版中。

I want to avoid targeting 26 我想避免以26为目标

I am not certain why, considering that 26 is the API level corresponding with the latest production release of Android (8.0). 我不确定为什么,考虑到26级是与Android(8.0)最新产品版本相对应的API级别。

Is it possible to download those sources? 是否可以下载这些来源?

Usually, the sources are not available via the IDE until the OS release ships in final form. 通常,在OS发布以最终形式发布之前,源不可通过IDE获得。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法找到带有哈希字符串“android-27”的目标 - Failed to find target with hash string 'android-27' 错误:无法使用哈希字符串“ android-27”找到目标 - Error: Failed to find target with hash string 'android-27' 找不到路径为 Platform SDK 的平台 SDK;android-27 - Failed to find Platform SDK with path: platforms;android-27 如何解决 Failed to find target with hash string 'android-27' in: C:\Users\iampr\AppData\Local\Android\sdk while launching app in flutter - How to solve Failed to find target with hash string 'android-27' in: C:\Users\iampr\AppData\Local\Android\sdk while launching app in flutter Android:升级到目标版本27 SDK - Android : Upgrading to target version 27 sdk 如何下载最新版 Android SDK for Visual Studio .NET 2017 - How to download the latest version of Android SDK for Visual Studio .NET 2017 当开始一个 android 项目时,我得到了这个:“错误:模块‘app’:平台‘android-27’未找到。” - When starting an android project i got this : "ERROR: Module 'app': platform 'android-27' not found." 在Android Studio中选择目标SDK - Choose the Target SDK in Android Studio 从最新的Android SDK迁移到Android Studio - Migrate from latest android sdk to android studio 如何在最新的 android 工作室中安装 android sdk - How to install android sdk in latest android studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM