Невозможно переместить зависимости с помощью теневого плагина для GradleAndroid

Форум для тех, кто программирует под Android
Ответить
Anonymous
 Невозможно переместить зависимости с помощью теневого плагина для Gradle

Сообщение Anonymous »

У меня есть проект, который использует библиотеку, содержащуюся в файле aar. Проблема в том, что мое приложение использует Daager 1 для внедрения зависимостей, оно использует Dagger 1, потому что я использую платформу, совместимую только с Dagger 1. Проблема в том, что библиотека, которую мне нужно использовать, использует Dagger 2 для внедрения зависимостей, поэтому, когда я добавляю библиотеку и я добавляю зависимости в файл градиента моего приложения, это не работает (как и ожидалось, поскольку Dagger 1 и Dagger 2 нельзя использовать одновременно из коробки), поэтому я пытаюсь переместить Зависимости Dagger 2 с использованием теневого плагина.
Я следил за этим руководством, чтобы узнать, как это сделать http://fernandocejas.com/2016/08/03/and ... ger-1-and- 2-living-together/
файлы jar генерируются внутри модулей, но пусты, они не содержат переименованных файлов для Dagger 2. Я скачал проект с GitHub https://github.com/android10/two-daggers, и это работает, но мне удается заставить его работать в моем проекте.
Мои файлы градиентов из созданных модулей являются точной копией из тех, что в учебнике. Вы видите, что я делаю не так?
Кроме того,shadow.gradle является точной копией.
Единственное отличие — мой build.gradle от мое приложение
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.jakewharton.hugo'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
applicationId "com.xxx.xxx"
minSdkVersion 16
targetSdkVersion 23
versionCode Integer.parseInt("$APP_VERSION_CODE")
versionName "$APP_VERSION_NAME"

testInstrumentationRunner "com.android.test.runner.MultiDexTestRunner"

// Enabling multidex support.
multiDexEnabled true

}

testBuildType "instrumentation"

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}

dexOptions{
javaMaxHeapSize "3g"
incremental true
}

testOptions {
unitTests.returnDefaultValues = true
}

//Append version to Apk name
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = outputFile.name.replace('app-', "AccessApp-")
fileName = fileName.replace('.apk', "-" + "$APP_TAG" + ".apk")
output.outputFile = new File(outputFile.parent, fileName)
}
}
}

packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/services/javax.annotation.processing.Processor'
}

lintOptions {
abortOnError false
disable 'InvalidPackage'
}
}

buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.github.jengelman.gradle.plugins:shadow:1.2.3"
classpath "com.neenbedankt.gradle.plugins:android-apt:1.4"
}
}

apply plugin: "com.github.johnrengelman.shadow"

dependencies {
repositories {
maven {
url "http://xxx.xx.xxx:0000/xxx/xxxxxx/"
}
jcenter()
flatDir {
dirs 'libs'
}
}

//Dagger 1
apt 'com.squareup.dagger:dagger-compiler:1.2.2'
compile 'com.squareup.dagger:dagger:1.2.2'

//Dagger 2
apt project(path: ':two-daggers-compiler', transitive: false)
compile project(path: ':two-daggers-library', transitive: false)

compile fileTree(dir: 'libs', include: ['*.jar'])

//Unit Tests
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'org.apache.maven:maven-ant-tasks:2.1.3'
testCompile 'joda-time:joda-time:2.3'
testCompile 'com.squareup.okhttp3:mockwebserver:3.2.0'
testCompile('org.robolectric:robolectric:3.0') {
exclude group: 'commons-logging', module: 'commons-logging'
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}

// Android instrumentation test dependencies
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test:runner:0.4.1'
// Set this dependency to use JUnit 4 rules
androidTestCompile 'com.android.support.test:rules:0.4.1'
// Set this dependency to build and run Espresso tests
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile 'com.android.support:support-annotations:23.4.0'

// Android dependencies
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'

//Rosie Framework
compile 'com.karumi.rosie:rosie:2.1.0'

// Connectivity library
compile 'com.xxx.connectivity:connectivity:1.0.0.013@aar'

// Maps
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'com.google.maps.android:android-maps-utils:0.4.3'

// Hockey App
compile 'net.hockeyapp.android:HockeySDK:4.0.2'

//Retrofit
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.retrofit2:converter-scalars:2.0.2'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'

// Images
compile 'com.squareup.picasso:picasso:2.5.2'

// Google Play Billing
compile 'com.anjlab.android.iab.v3:library:1.0.31'
compile 'joda-time:joda-time:2.3'

// View pager indicator
compile 'com.github.JakeWharton:ViewPagerIndicator:2.4.1@aar'
compile 'me.grantland:autofittextview:0.2.1'

// Event bus
compile 'org.greenrobot:eventbus:3.0.0'

//Roboto font
compile 'uk.co.chrisjenx:calligraphy:2.2.0'

//MixPanel
compile "com.mixpanel.android:mixpanel-android:4.8.7"

//Amazon
compile "com.amazonaws:aws-android-sdk-mobileanalytics:2.2.9"

//AppsFlyer
compile 'com.appsflyer:af-android-sdk:4.5.0@aar'

//Multidex
compile 'com.android.support:multidex:1.0.1'
androidTestCompile 'com.android.support:multidex-instrumentation:1.0.1'

// Smart tab layout
compile 'com.ogaclejapan.smarttablayout:library:1.6.1@aar'
compile 'com.ogaclejapan.smarttablayout:utils-v4:1.6.1@aar'

// Permissions
compile 'com.karumi:dexter:2.2.2'

// AP Geolocation
compile 'com.fon.analytics:analytics-sdk:0.4.3'

compile 'com.github.PhilJay:MPAndroidChart:v2.2.5'

// WPA sharing library
compile 'com.google.guava:guava:18.0'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.j256.ormlite:ormlite-core:4.48'

//multiDex
compile 'com.android.support:multidex:1.0.1'
}


Подробнее здесь: https://stackoverflow.com/questions/391 ... for-gradle
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»