나는 항상 받고 java.lang.ClassNotFoundException: ru.ooolpi.lpiapp.ui.activity.MainActivity
있습니다. 하지만 그런 수업이 있습니다. 나중에 내 프로젝트 파일이 apk에서 누락되었음을 발견했습니다.
내 빌드 스크립트 :
buildscript {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
// classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.1'
//classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
}
}
//apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
repositories {
maven { url 'https://github.com/donnfelker/mvn-repo/raw/master/' }
maven { url 'https://repo.commonsware.com.s3.amazonaws.com' }
jcenter()
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.squareup.dagger:dagger:1.2.2'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup:otto:1.3.8'
apt 'com.squareup.dagger:dagger-compiler:1.0.1'
}
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
//applicationId "ru.ooolpi.lpiapp"
minSdkVersion 10
targetSdkVersion 22
versionCode 2
versionName "1.0.1"
multiDexEnabled true
}
packagingOptions {
// Exclude file to avoid
// Error: Duplicate files during packaging of APK
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/notice.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE.txt'
exclude '.readme'
}
dexOptions {
jumboMode = true
javaMaxHeapSize "4g"
}
signingConfigs {
release {
storeFile file('../devcert.jks')
storePassword '123456'
keyAlias 'dev'
keyPassword '123456'
}
}
lintOptions {
//disable 'InvalidPackage'
abortOnError false
}
compileOptions{
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
zipAlignEnabled true // this is default for release
}
debug {
applicationIdSuffix '.debug'
minifyEnabled false
}
}
}
나는 Android Studio와 gradlew로 빌드하려고했습니다. 결과는 동일합니다. 내 파일은 apk에 포함되지 않습니다.
업데이트 : 내 프로젝트 구조
문제는 단검에 다른 버전을 사용했고 컴파일러라는 것입니다.
어땠 니:
compile 'com.squareup.dagger:dagger:1.2.2'
apt 'com.squareup.dagger:dagger-compiler:1.0.1'
다음과 같아야합니다.
compile 'com.squareup.dagger:dagger:1.2.2'
apt 'com.squareup.dagger:dagger-compiler:1.2.2'
그래서 Android Studio는 내 코드에서 문제를 강조하지 않았습니다 (이것들이 왜 관련되어 있는지 모르겠습니다).
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다