相关疑难解决方法(0)

我可以使用Android支持androidx项目的库吗?

我知道,androidx和支持依赖导致multidex错误 我们不能同时使用androidx和android支持.所以我完全迁移到androidx.但我的一个依赖lib使用了android支持"lottie".

在上述情况下我们能做些什么?我应该从我的项目中删除'lottie'吗?

下面是我的傻瓜

defaultConfig {
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
    }

    ext{
    lottieVersion = "2.5.4"
}


dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    def androidx = "1.0.0-rc01"
    api "androidx.constraintlayout:constraintlayout:1.1.2"
    api "androidx.appcompat:appcompat:$androidx"
    api "androidx.recyclerview:recyclerview:$androidx"
    api "androidx.cardview:cardview:$androidx"
    api "androidx.core:core-ktx:$androidx"
    api "com.google.android.material:material:1.0.0-rc01"
    implementation "com.google.code.gson:gson:2.8.5"
    implementation "androidx.multidex:multidex:2.0.0"
    implementation "com.airbnb.android:lottie:$lottieVersion"
    }
Run Code Online (Sandbox Code Playgroud)

android android-jetpack

63
推荐指数
4
解决办法
4万
查看次数

Flutter的Multidex问题

我在使用Android Studio中的Flutter时使用gradle编译以下错误:

Dex: Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzcew;
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzcew;

[... stacktrace omitted for brevity ...]

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'.
> com.android.build.api.transform.TransformException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzcew;
Run Code Online (Sandbox Code Playgroud)

简短的版本

只有在我添加足够的依赖项时才会出现这种情况,如预期的那样.我已启用multidex并build.gradle根据说明(https://developer.android.com/studio/build/multidex.html)在Android项目文件中添加了multidex依赖项,但不知道如何处理第2步中的操作对于Flutter应用程序"为multidex配置应用程序",甚至是否遗漏了该步骤是问题所在.

重新创建的步骤:

  1. File/New/New Flutter Project从工具栏中选择
  2. 选择"颤动应用程序"
  3. 包括Kotlin和Swift支持
  4. 检查应用程序编译并运行
  5. 将以下内容添加到依赖项中pubspec.yaml:

    dependencies:
      flutter_google_place_picker: "^0.0.1"
      location: "^1.2.0"
    
    Run Code Online (Sandbox Code Playgroud)
  6. 点击Packages GetAndroid Studio或flutter packages get在项目目录中运行
  7. 修改android/app/build.gradle …

android android-gradle-plugin flutter

14
推荐指数
5
解决办法
9336
查看次数

无法解决:com.android.support:support-v4:26.0.2

当我使用这个库时:

compile 'co.ronash.android:pushe-base:1.4.0'
Run Code Online (Sandbox Code Playgroud)

我在gradle中得到这个错误:

Failed to resolve: com.android.support:support-v4:26.0.2
Run Code Online (Sandbox Code Playgroud)

我无法解决它.

还有就是在那里库忽视的解决方案 'com.android.support:support-v4:26.0.2''co.ronash.android:pushe-base:1.4.0'

因为我已经编译了一个较新版本的support-v4库.

我的所有依赖项代码都是gradle:

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:support-v4:26.+' //--> its ok and no problem
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'co.ronash.android:pushe-base:1.4.0' //--->this code is error Failed to resolve: com.android.support:support-v4:26.0.2
compile 'com.google.android.gms:play-services-gcm:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
testCompile 'junit:junit:4.12'
}
Run Code Online (Sandbox Code Playgroud)

java android pushe

6
推荐指数
1
解决办法
601
查看次数

程序类型已存在:com.google.android.material.internal.package-info

我在编译代码时遇到此错误:

<!-- language: lang-none -->        
Program type already present: 
    com.google.android.material.internal.package-info
    Message{kind=ERROR, text=Program type already present: 
    com.google.android.material.internal.package-info, sources= 
    [Unknown source file], tool name=Optional.of(D8)}
Run Code Online (Sandbox Code Playgroud)

当我搜索类似的错误时,它建议添加

configurations {all*.exclude group: 'com.android.support', module: 'support-v13'}
Run Code Online (Sandbox Code Playgroud)

或将这些行添加到“ gradle.properties ”文件

android.useAndroidX = true
android.enableJetifier = false
Run Code Online (Sandbox Code Playgroud)

但这些解决方案都不适合我,这是我的 gradle 文件

app 

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
    compileSdkVersion 28  
    defaultConfig {
        applicationId "com.example.agh.yaomi"
        minSdkVersion 17
        targetSdkVersion 28
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), …
Run Code Online (Sandbox Code Playgroud)

android gradle android-studio

5
推荐指数
1
解决办法
4567
查看次数