英文:
error: package com.nguyenhoanglam.imagepicker.activity does not exist
问题
以下是您提供的代码的中文翻译:
没有编译错误。我在运行时收到了这个错误。
错误:包com.nguyenhoanglam.imagepicker.activity不存在
我在我的项目中使用了许多库。库链接:
https://github.com/nguyenhoanglam/ImagePicker
- 我添加了Glide库
- 将compileSdkVersion和targetSdkVersion从28更改为29。
- 迁移到了AndroidX
在更改之前没有问题。
**项目Gradle:**
//顶级构建文件,您可以在其中添加所有子项目/模块的常见配置选项。
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.4'
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
**应用Gradle:**
apply plugin: 'com.android.application'
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
maven { url "https://jitpack.io" }
google()
jcenter()
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.4, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
android {
compileSdkVersion 29
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "x.y.z"
manifestPlaceholders = [onesignal_app_id: "XX",
onesignal_google_project_number: "YY"]
minSdkVersion 16
targetSdkVersion 29
versionCode 35
versionName "3.10.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.intuit.sdp:sdp-android:1.0.3'
implementation 'com.jaredrummler:material-spinner:1.1.0'
implementation 'com.github.nguyenhoanglam:ImagePicker:1.4.3'
implementation 'com.google.android.gms:play-services-ads:19.3.0'
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
implementation 'com.github.hotchemi:android-rate:1.0.1'
implementation 'com.karumi:dexter:5.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-core:17.4.4'
implementation 'com.google.firebase:firebase-database:19.3.1'
implementation 'com.google.firebase:firebase-messaging:20.2.4'
testImplementation 'junit:junit:4.12'
implementation 'com.onesignal:OneSignal:[3.11.2, 3.99.99]'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
}
apply plugin: 'com.google.gms.google-services'
如何解决我的问题?
英文:
There is no compiler error. I am getting this error in runtime.
error: package com.nguyenhoanglam.imagepicker.activity does not exist
I am using many library in my project. Library link:
https://github.com/nguyenhoanglam/ImagePicker
- I added glide library
- Changed compileSdkVersion & targetSdkVersion from 28 to 29.
- Migrated project to AndroidX
There was no problem before the change.
Project Gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
maven { url "https://jitpack.io"}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.4'
//classpath 'com.google.gms:google-services:1.3.0-beta1'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io"}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App Gradle:
apply plugin: 'com.android.application'
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
maven { url "https://jitpack.io" }
google()
jcenter()
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.4, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
android {
compileSdkVersion 29
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "x.y.z"
manifestPlaceholders = [onesignal_app_id: "XX",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "YY"]
minSdkVersion 16
targetSdkVersion 29
versionCode 35
versionName "3.10.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.intuit.sdp:sdp-android:1.0.3'
implementation 'com.jaredrummler:material-spinner:1.1.0'
implementation 'com.github.nguyenhoanglam:ImagePicker:1.4.3'
implementation 'com.google.android.gms:play-services-ads:19.3.0'
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
implementation 'com.github.hotchemi:android-rate:1.0.1'
implementation 'com.karumi:dexter:5.0.0'
//4.1.0
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-core:17.4.4'
implementation 'com.google.firebase:firebase-database:19.3.1'
implementation 'com.google.firebase:firebase-messaging:20.2.4'
testImplementation 'junit:junit:4.12'
implementation 'com.onesignal:OneSignal:[3.11.2, 3.99.99]'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
}
apply plugin: 'com.google.gms.google-services'
How can I solve my problem?
答案1
得分: 5
Library changed.
In fact, I am using Java, not Kotlin.
When I look at the library, I saw that there is another equivalent library for Java.
https://github.com/esafirm/android-image-picker
This library works without any problem now. I do not know why the first library is not working.
英文:
Library changed.
In fact I am using Java not Kotlin.
When I look the library, I saw that there is another equivalent library for Java.
https://github.com/esafirm/android-image-picker
This library works without any problem, now. I do not know why the first library is not working.
答案2
得分: 2
你可以使用Android-Image-Cropper,这对我来说似乎非常可行和方便。
英文:
You can use Android-Image-Cropper which seems very feasible and handy to me.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论