[英]Android Studio - package java.awt.image does not exist
I have a problem running my project on Android Studio.我在 Android Studio 上运行我的项目时遇到问题。 I am working on an Android project that has a native Java library inside it.
我正在开发一个内置 Java 库的 Android 项目。 It was running fine all the time.
它一直运行良好。 But suddenly when I open Android Studio, I find this error:
但是突然当我打开Android Studio时,我发现了这个错误:
There is also an error in the .gradle of the project:项目的.gradle也有错误:
It says that URI is not registered.它说 URI 未注册。
When Android Studio is started, I find this message:当 Android Studio 启动时,我发现此消息:
It seems that there is something wrong in Java configuration, but I can't find out what is the problem?好像是Java配置有问题,但是查不出来是什么问题?
It was running fine all the time
它一直运行良好
Not on Android, it wasn't.不是在 Android 上,不是。
It seems that there is something wrong in Java configuration
Java配置好像有问题
No. You are using classes that are not part of the Android SDK.不可以。您使用的类不是 Android SDK 的一部分。
The java Swing and AWT API are not part of the Android SDK and thus aren't including with it. java Swing 和 AWT API 不是 Android SDK 的一部分,因此不包含在其中。 You must find an Android equivalent image library to use in your app.
您必须找到要在您的应用中使用的 Android 等效图像库。 There are few good ones around just depends on what functionality you need to have available to you in you app.
很少有好的东西取决于您需要在您的应用程序中使用哪些功能。 Try searching Picasso and or Volley .
尝试搜索Picasso和或Volley 。 Picasso is very popular and well known.
毕加索非常受欢迎和知名。 it has a lot of feature including networking functionality for loading images from the web.
它有很多功能,包括从网络加载图像的网络功能。 The Volley library isn't an image library but an networking library that contains some predefined classes for loading images over the internet.
Volley 库不是图像库,而是一个网络库,其中包含一些用于通过 Internet 加载图像的预定义类。
So this just happened to me.所以这只是发生在我身上。 I'm not 100% on the details of how I got it working again, but its roughly this (on my Mac):
我不是 100% 了解如何让它再次工作的细节,但大致是这样的(在我的 Mac 上):
And once Android Studio restarts, chose to rebuild your project, and then it worked.一旦 Android Studio 重新启动,选择重建您的项目,然后它就可以工作了。
Good Luck and I hope this works for you too.祝你好运,我希望这也适用于你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.