Github上的Maven Repository没有下载传递依赖项

问题描述 投票:1回答:1

我创建了一个maven存储库并将其上传到Github。当我将其作为依赖项添加到示例项目时,gradle sync成功完成。但是当我尝试运行应用程序时,它崩溃了java.lang.NoClassDefFoundError。

链接到存储库:https://github.com/rjain90/sdk

示例项目代码:

项目build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext{
        kotlin_version = '1.3.20'
        realm_version = '5.8.0'
    }
    repositories {
        google()
        jcenter()
        maven { url "https://raw.githubusercontent.com/rjain90/sdk/master/" }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "io.realm:realm-gradle-plugin:$realm_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://raw.githubusercontent.com/rjain90/sdk/master/" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

ext{
    lifecycle_version = '2.0.0'
    android_support_version = '1.1.0-alpha01'
    legacy_support_version = '1.0.0'
    constraint_version = '1.1.3'

    retrofit_version = '2.4.0'
    dagger_version = '2.16'

    rxjava_version = '2.1.7'
    rxandroid_version = '2.0.1'
}

模块build.gradle

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'kotlin-kapt'

apply plugin: 'realm-android'

// Load keystore
def keystorePropertiesFile = rootProject.file("keystore.properties");
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
    signingConfigs {
        release {
            keyAlias keystoreProperties['ANDROID_KEY_ALIAS']
            keyPassword keystoreProperties['ANDROID_KEY_PASSWORD']
            storeFile file(keystoreProperties['ANDROID_KEYSTORE_LOCATION'])
            storePassword keystoreProperties['ANDROID_STORE_PASSWORD']
        }
    }

    compileSdkVersion 28
    defaultConfig {
        applicationId "com.bowstring.godworld"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        debug {
            debuggable true
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

        release {
            signingConfig signingConfigs.release
            debuggable false
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
}

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

    implementation "androidx.appcompat:appcompat:$android_support_version"
    implementation "androidx.constraintlayout:constraintlayout:$constraint_version"

    implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
    implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit_version"

    implementation "com.google.dagger:dagger:$dagger_version"
    kapt "com.google.dagger:dagger-compiler:$dagger_version"

    implementation "io.reactivex.rxjava2:rxandroid:$rxandroid_version"

    implementation "androidx.legacy:legacy-support-v4:$legacy_support_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'


    implementation 'com.squareup.picasso:picasso:2.71828'

    implementation 'com.cabfare.android:sdk:0.0.18@aar'
}
android maven github aar transitive-dependency
1个回答
0
投票

对于GitHub托管,您可以使用https://jitpack.io作为Maven存储库。

maven { url 'https://jitpack.io' }添加到项目build.gradleallprojects -> repositories块中,然后在您的模块build.gradle中,添加依赖项implementation 'com.github.rjain90:sdk:0.0.17',例如。

但是,你的两个版本都是containing build errors。首先解决它们。

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.