此错误是什么意思,我该如何解决?

时间:2018-08-29 20:28:26

标签: java android-studio-3.0

当我尝试使用随机数时,会出现以下错误,那么如何使用其他方法修改代码?

minSdkVersion 19

targetSdkVersion 28

W/art: Before Android 4.1, method double java.util.concurrent.ThreadLocalRandom.internalNextDouble(double, double) would have incorrectly overridden the package-private method in java.util.Random
   Before Android 4.1, method int java.util.concurrent.ThreadLocalRandom.internalNextInt(int, int) would have incorrectly overridden the package-private method in java.util.Random
   Before Android 4.1, method long java.util.concurrent.ThreadLocalRandom.internalNextLong(long, long) would have incorrectly overridden the package-private method in java.util.Random

java代码

    Random r = new Random();
    int i = r.nextInt(16 - 6)+6;
    long maxTimeInMilliseconds = (i*1000);
    startTimer(maxTimeInMilliseconds,1000);

1 个答案:

答案 0 :(得分:0)

这不是错误,而是警告。您可以忽略它,因为您的minSdkVersiontargetSdkVersion都针对的Android版本高于此警告所针对的Android版本。

这基本上是在告诉您:“嘿,请注意,如果您将SDK版本更改为15或更低版本,则此代码将无法正常运行。”