我正在尝试在家学习Android Studio,今天我正在学习null
,并跟随了一个剪辑,但在该剪辑的末尾它起作用了,但对我来说却不是,我遇到以下错误:< / strong>
错误:程序类型已存在: android.support.v4.graphics.drawable.IconCompatParcelizer
我的build.gradle
ocr
我的activity_main.xml
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.android.imagetotextmobileload"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//image crop library
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
//image to text google library
implementation 'com.google.android.gms:play-services-vision:17.0.2'
}
和我的MainActivity.java文件
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
tools:context=".MainActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="#fff"
app:cardUseCompatPadding="true"
app:cardCornerRadius="3dp"
app:cardElevation="3dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<TextView
android:text="Result"
android:textColor="@color/colorPrimary"
android:textSize="20sp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<!--The scanned text from image will display here-->
<EditText
android:id="@+id/resultEt"
android:hint="Click + button to insert Image"
android:autoLink="all"
android:background="@null"
android:padding="5dp"
android:textColor="#000"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="#fff"
app:cardUseCompatPadding="true"
app:cardCornerRadius="3dp"
app:cardElevation="3dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<TextView
android:text="Image Preview"
android:textColor="@color/colorPrimary"
android:textSize="20sp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<!--The image taken will be displayed here-->
<ImageView
android:id="@+id/imageIv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxHeight="250dp"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>
</RelativeLayout>