Android Api 24找不到来源

时间:2022-07-27 15:32:15

I have this grade file:

我有这个成绩档案:

//ext.support_library_version = '24.0.0'

    android {
        compileSdkVersion 24
        buildToolsVersion '24.0.0'

        defaultConfig {
            applicationId "---"
            minSdkVersion 21
            targetSdkVersion 24
            versionCode 1
            versionName "1.0"
        }
    ...
    }

But then when i try to open any android related class, it says i haven't got sources for api24, even tho the buildToolsVersion '24.0.0' is installed. Any idea why?

但是当我尝试打开任何与Android相关的类时,它表示我没有api24的来源,即使安装了buildToolsVersion '24 .0.0'也是如此。知道为什么吗?

3 个解决方案

#1


32  

Sources for Android N are not yet published and not available for installation in the SDK manager. When the source package becomes available, you need to install it separately, as with any previous SDK version.

Android N的源尚未发布,无法在SDK管理器中安装。当源包可用时,您需要单独安装它,就像以前的任何SDK版本一样。


Update 2016-08-24: The Android API 24 sources are now available in the SDK manager.

更新2016-08-24:现在SDK管理器中提供了Android API 24源代码。

After downloading you might need this trick to refresh the SDK installation.

下载后,您可能需要此技巧来刷新SDK安装。

#2


1  

I had the same problem with API 25 and Android Studio 2.2

我在API 25和Android Studio 2.2上遇到了同样的问题

Try the following:

请尝试以下方法:

  1. Close Android Studio.

    关闭Android Studio。

  2. Open ~/Library/Preferences/AndroidStudio2.2/options/jdk.table.xml or C:\Users{USER_NAME}.AndroidStudio2.2\config\options\jdk.table.xml

    打开〜/ Library / Preferences / AndroidStudio2.2 / options / jdk.table.xml或C:\ Users {USER_NAME} .AndroidStudio2.2 \ config \ options \ jdk.table.xml

Note the Android Studio version in the pach.

请注意pach中的Android Studio版本。

  1. Locate <sourcePath> for Android API 24 Platform and for previous one. You can look that <sourcePath> for problem API hasn't second <root> element with url.

    找到Android API 24平台的 和前一个。您可以看到问题API的 没有带url的第二个 元素。

  2. Investigate path of sources, check that sources was really installed.

    调查源的路径,检查源是否真正安装。

  3. Copy <root> from another <sourcePath> and set correct url. It will be similar to

    从另一个 复制 并设置正确的url。它将类似于

    <sourcePath>
      <root type="composite">
        <root type="simple" url="file://$USER_HOME$/Library/Android/sdk/sources/android-24" />
      </root>
    </sourcePath>
    
  4. Save the file and start Android Studio

    保存文件并启动Android Studio

https://*.com/a/36825435/1263771

#3


0  

To get the newest Android API's (SDK Platform)

获取最新的Android API(SDK平台)

Make sure you update the Android SDK Tools to the latest version in the Android SDK Manager first.

确保首先将Android SDK工具更新到Android SDK Manager中的最新版本。

#1


32  

Sources for Android N are not yet published and not available for installation in the SDK manager. When the source package becomes available, you need to install it separately, as with any previous SDK version.

Android N的源尚未发布,无法在SDK管理器中安装。当源包可用时,您需要单独安装它,就像以前的任何SDK版本一样。


Update 2016-08-24: The Android API 24 sources are now available in the SDK manager.

更新2016-08-24:现在SDK管理器中提供了Android API 24源代码。

After downloading you might need this trick to refresh the SDK installation.

下载后,您可能需要此技巧来刷新SDK安装。

#2


1  

I had the same problem with API 25 and Android Studio 2.2

我在API 25和Android Studio 2.2上遇到了同样的问题

Try the following:

请尝试以下方法:

  1. Close Android Studio.

    关闭Android Studio。

  2. Open ~/Library/Preferences/AndroidStudio2.2/options/jdk.table.xml or C:\Users{USER_NAME}.AndroidStudio2.2\config\options\jdk.table.xml

    打开〜/ Library / Preferences / AndroidStudio2.2 / options / jdk.table.xml或C:\ Users {USER_NAME} .AndroidStudio2.2 \ config \ options \ jdk.table.xml

Note the Android Studio version in the pach.

请注意pach中的Android Studio版本。

  1. Locate <sourcePath> for Android API 24 Platform and for previous one. You can look that <sourcePath> for problem API hasn't second <root> element with url.

    找到Android API 24平台的 和前一个。您可以看到问题API的 没有带url的第二个 元素。

  2. Investigate path of sources, check that sources was really installed.

    调查源的路径,检查源是否真正安装。

  3. Copy <root> from another <sourcePath> and set correct url. It will be similar to

    从另一个 复制 并设置正确的url。它将类似于

    <sourcePath>
      <root type="composite">
        <root type="simple" url="file://$USER_HOME$/Library/Android/sdk/sources/android-24" />
      </root>
    </sourcePath>
    
  4. Save the file and start Android Studio

    保存文件并启动Android Studio

https://*.com/a/36825435/1263771

#3


0  

To get the newest Android API's (SDK Platform)

获取最新的Android API(SDK平台)

Make sure you update the Android SDK Tools to the latest version in the Android SDK Manager first.

确保首先将Android SDK工具更新到Android SDK Manager中的最新版本。