JAR文件C:\ sdk\platforms\android-18\android.jar没有源附件.您可以通过单击下面的附加源来附加源

Hel*_*ojo 4 java eclipse

我收到一条错误说明:

The JAR file C:\sdk\platforms\android-18\android.jar has no source attachment. You can attach the source by clicking attach source below.
Run Code Online (Sandbox Code Playgroud)

但是我点击了附加源按钮并添加了C:\ sdk\platforms\android-17\android.jar然后它只是给了我:

Source not found. The source attachment does not contain the source for the file Activity.class. You can change the source attachment by clicking Change Attached Source below.
Run Code Online (Sandbox Code Playgroud)

inm*_*320 15

首先确保您已经通过Android SDK Manager下载了项目中正在使用的Android版本的源文件:http://developer.android.com/sdk/installing/adding-packages.html

然后右键单击您的项目并选择属性,从左侧菜单中选择"Java Build Path",选择右侧的"Libraries"选项卡,单击以展开"Android XXX",单击以展开"android.jar",然后然后双击"源附件:"项.

在弹出窗口中,选择"外部位置",单击"外部文件夹",然后浏览到适合之前选择的"Android XXX"的android-sdk/sources/android-xx.选择确定以关闭对话框,您应该设置!