我正在制作一个Android应用程序。我引用了一个名为Recognition的java项目。当我从它的android项目中调用一个函数时,它崩溃了,用这个日志:
java项目使用BufferedImage对象,并设置为JRE 1.6。
有谁知道问题是什么?
由于
编辑:
我认为问题是Path
需要1.7,但android正在使用1.6我该如何解决?
08-28 21:52:04.595: E/AndroidRuntime(21763): FATAL EXCEPTION: main
08-28 21:52:04.595: E/AndroidRuntime(21763): java.lang.NoClassDefFoundError: java.nio.file.Paths
08-28 21:52:04.595: E/AndroidRuntime(21763): at recognition.Recognize.getImage(Recognize.java:168)
08-28 21:52:04.595: E/AndroidRuntime(21763): at recognition.Recognize.getInitialImage(Recognize.java:80)
08-28 21:52:04.595: E/AndroidRuntime(21763): at recognition.Recognize.runAnalysis(Recognize.java:46)
08-28 21:52:04.595: E/AndroidRuntime(21763): at android.arin.SpeciesScreen.onActivityResult(SpeciesScreen.java:131)
08-28 21:52:04.595: E/AndroidRuntime(21763): at android.app.Activity.dispatchActivityResult(Activity.java:5361)
08-28 21:52:04.595: E/AndroidRuntime(21763): at android.app.ActivityThread.deliverResults(ActivityThread.java:3201)
08-28 21:52:04.595: E/AndroidRuntime(21763): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3248)
08-28 21:52:04.595: E/AndroidRuntime(21763): at android.app.ActivityThread.access$1200(ActivityThread.java:143)
08-28 21:52:04.595: E/AndroidRuntime(21763): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289)
08-28 21:52:04.595: E/AndroidRuntime(21763): at android.os.Handler.dispatchMessage(Handler.java:99)
08-28 21:52:04.595: E/AndroidRuntime(21763): at android.os.Looper.loop(Looper.java:137)
08-28 21:52:04.595: E/AndroidRuntime(21763): at android.app.ActivityThread.main(ActivityThread.java:4950)
08-28 21:52:04.595: E/AndroidRuntime(21763): at java.lang.reflect.Method.invokeNative(Native Method)
08-28 21:52:04.595: E/AndroidRuntime(21763): at java.lang.reflect.Method.invoke(Method.java:511)
08-28 21:52:04.595: E/AndroidRuntime(21763): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)
08-28 21:52:04.595: E/AndroidRuntime(21763): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
08-28 21:52:04.595: E/AndroidRuntime(21763): at dalvik.system.NativeStart.main(Native Method)
这是getImage函数
private static BufferedImage getImage(String from) throws IOException {
Path path = Paths.get(from);
File file = path.toFile();
if (file.exists()) {
InputStream stream = Files.newInputStream(path);
BufferedImage bufferedImage = ImageIO.read(stream);
BufferedImage NewBufferedImage = convertToARGB(bufferedImage);
bufferedImage.flush();
bufferedImage = NewBufferedImage;
return bufferedImage;
}
return null;
}
这是android构建顺序: