J'utilise Dagger 2.11 avec la prise en charge d'Android Injection. Après avoir ajouté une grande quantité de dépendances, j'ai été forcé d'activer MultiDex.Dagger 2 et l'application Multidex
Le support pour Multidex a été ajouté, sur Android 4.4 fonctionne comme prévu, sur Android> = 6 fonctionne très bien.
Le problème apparaît uniquement sur Android 5 et 5.1 i obtenir l'erreur suivante:
Caused by: java.lang.ClassNotFoundException: Didn't find class "dagger.internal.Preconditions" on path: DexPathList[[zip file...
I tryed pour ajouter le "dagger.internal.Preconditions"
au fichier que j'utilise dans multiDexKeepProguard
, sans chance.
Le fichier build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.tmiyamon.config'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.tmiyamon.config'
apply plugin: 'realm-android'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "appId"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
dexOptions {
preDexLibraries false
javaMaxHeapSize "4g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
signingConfigs {
debug {
storeFile file("path")
keyAlias "alias"
storePassword "password"
keyPassword "password"
}
release {
storeFile file("path")
keyAlias "alias"
storePassword "password"
keyPassword "password"
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
minifyEnabled false
zipAlignEnabled false
testCoverageEnabled false
multiDexKeepProguard file('multidex-config.pro')
proguardFiles fileTree(dir: 'proguard').asList().toArray()
}
release {
minifyEnabled true
multiDexKeepProguard file('multidex-config.pro')
proguardFiles fileTree(dir: 'proguard').asList().toArray()
signingConfig signingConfigs.release
}
}
productFlavors {
local {
applicationIdSuffix ".local"
versionNameSuffix " Local " + calculateVersionNameSuffix()
}
staging {
applicationIdSuffix ".staging"
versionNameSuffix " Staging " + calculateVersionNameSuffix()
}
production {
}
}
}
dependencies {
long list of dependencies
}
et le fichier Manifest:
<manifest package="package"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<< permissions >>
<!--${applicationId}-->
<application
android:name=".application.MyApplication"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="${launcherAppName}"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:label">
<activity
android:name=".ui.startup.StartupActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
rest of the Manifest....
pouvez-vous s'il vous plaît poster votre fichier build gradle et votre fichier Android.xml ? –
sûr, donnez-moi quelques minutes – Eddy
pouvez-vous s'il vous plaît vérifier le fil suivant https://stackoverflow.com/questions/45672340/android-classnotfoundexception-while-class-is-present/45672463#45672463. Vous devez peut-être définir une classe d'application Android Multidex –