缩放和裁剪图像(从相机或图库拍摄)

时间:2019-07-25 06:53:03

标签: android-studio

所以我希望能够缩放和裁剪刚刚从照片中拍摄或从图库中选择的图像。

到目前为止,我发现了这个图书馆:

https://github.com/biokys/cropimage

尽管我真的不知道如何将这个库添加到我的项目中。因此,我开始从github导入项目,进行编译,然后以某种方式手动将其添加到我的项目中。

很遗憾,我无法使其正常运行。我最初使用的是Gradle 4.10.1。在Gradle 4.10.1上,出现以下错误:

ERROR: Unable to load class 'org.gradle.api.artifacts.result.ResolvedModuleVersionResult'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)

The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)

Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

执行这些建议没有帮助。我还尝试降级到Gradle的早期版本(例如1.9版),但是随后出现其他错误:

ERROR: Could not determine the class-path for class com.android.tools.idea.gradle.project.sync.ng.SyncAction.

欢迎提供有关如何使该库工作的任何想法,或欢迎使用其他裁剪和缩放方法。基本上,用户使用自己的相机拍摄了一张照片(已经可以使用该照片了),然后我立即想将其传递给某个东西,以便他们可以对其进行裁剪和缩放,然后在应用程序中使用它。在他们从图库中选择照片后(也要使该部分也起作用),我也将其发送给他们,以便进行裁剪和缩放。

任何建议表示赞赏。谢谢。

1 个答案:

答案 0 :(得分:1)

您使用的库无法轻松导入。唯一的选择是从git hub项目副本中将Java文件复制到您的项目中。 但我建议您使用此链接,这是一个具有裁剪和图像选择功能的库。

https://github.com/igreenwood/SimpleCropView

相关问题