How do I install Android SDK Platform-Tools 24.0.0

2019-04-29 09:37发布

问题:

I'm following the guide for setting up the Android N Preview https://developer.android.com/preview/setup-sdk.html

In "Update or Create a Project" Google says I need to have 24.0.0 platform tools.

Just be sure that you've updated your project to use Android SDK Build Tools 24.0.0 and Android SDK Platform-Tools 24.0.0.

I have installed the new SDK Platform: Android 6.X (N), API Level 24, Revision 1. However when I open SDK Tools the only Android SDK Platform-Tools version is 23.1.

I have updated my build.gradle for Android 24 and for Jack and Java 8 (see).

Everything works great on Android 24 simulator but crashes on a device or simulator running Android 22/23 (less than 24) with the following error:

java.lang.NoSuchMethodError: No virtual method stream()Ljava/util/stream/Stream; in class Ljava/util/ArrayList; or its super classes (declaration of 'java.util.ArrayList' appears in /system/framework/core-libart.jar)

I suspect the cause is having SDK Platform-Tools version 23.1.0 instead of 24.0.0 but if there is another solution i'd be happy to hear it.

Edit

Installing platform tools 24.0.0 rc1 did not fix the crash. I'm not sure what else to try given that I have followed all the instructions to setup the preview and the Jack compiler.

回答1:

but crashes on a device or simulator running Android 22/23 (less than 24) with the following error

java.util.stream.Stream was added in API Level 24. This class cannot be used on older devices.

Certain Java 8 features, like lambda expressions, may work on older devices, but not classes that were introduced in Android N.



回答2:

Just select the show package details and then you can find all the versions. Refer to the attached image



回答3:

Asuming you have Android Studio 2.1

Launch the standalone SDK manager.

From there Android N API 24 should be available to install



回答4:

Your API level 24 app runs OK with Android 24 (virtual) device but doesn't work with pre-24 device - so everything is exactly as one would expect.