gpt4 book ai didi

java - Android添加库报错

转载 作者:太空狗 更新时间:2023-10-29 14:59:45 24 4
gpt4 key购买 nike

你好,我使用 Cropper 库,我使用 android 向导添加了一个项目,但在 xml 中标记了一个错误

import com.edmodo.cropper.CropImageView;
CropImageView crop_image_view;

工作正常,可以导入我的 xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<com.edmodo.cropper.CropImageView
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:id="@+id/crop_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:aspectRatioX="5"
custom:showGuidelines="onTouch"
/>
</LinearLayout>

渲染问题注意该项目包含Java编译错误,可能导致自定义 View 渲染失败首先修复编译问题

The following classes could not be instantiated:
- com.edmodo.cropper.CropImageView (Open Class, Show Exception)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE Exception Details org.xmlpull.v1.XmlPullParserException: name expected (position:START_TAG <null>@4:59 in java.io.StringReader@eb8d000)

我的gradlie:

android {
compileSdkVersion 19
buildToolsVersion "19.1.0"

defaultConfig {
applicationId "com.example.android"
minSdkVersion 16
targetSdkVersion 19
versionCode 1
versionName "1.0"
}

buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

repositories {
mavenCentral()
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':cropper')
}

我的错误在哪里?

最佳答案

您是否尝试过像下面这样添加依赖项:

compile 'com.edmodo:cropper:1.0.1'

关于java - Android添加库报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28056645/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com