一直有android studio的这个问题。我有子文件夹(包)和A.Studio似乎没有正确链接它们 - 或者我做错了
这是我的项目结构
我的activity helper类使用ActivityUIHelper类 - 但A.Studio会抛出错误
Could not find class 'com.mface.mcall.ui.base.ActivityUIHelper', referenced from method com.mface.mcall.ui.base.ActivityHelper.<init>
完整的错误日志
12-31 03:47:39.719 3600-3600/com.mface.mcall E/dalvikvm﹕ Could not find class 'com.mface.mcall.ui.base.ActivityUIHelper', referenced from method com.mface.mcall.ui.base.ActivityHelper.<init>
12-31 03:47:39.729 3600-3600/com.mface.mcall E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.VerifyError: com/mface/mcall/ui/base/ActivityHelper
at com.mface.mcall.ui.base.BaseActivity.onCreate(BaseActivity.java:99)
at com.mface.mcall.ui.splash.SplashActivity.onCreate(SplashActivity.java:36)
at android.app.Activity.performCreate(Activity.java:5203)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2078)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2139)
at android.app.ActivityThread.access$700(ActivityThread.java:143)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4960)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
12-31 03:48:17.439 3793-3793/com.mface.mcall E/dalvikvm﹕ Could not find class 'com.mface.mcall.ui.base.ActivityUIHelper', referenced from method com.mface.mcall.ui.base.ActivityHelper.<init>
12-31 03:48:17.449 3793-3793/com.mface.mcall E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.VerifyError: com/mface/mcall/ui/base/ActivityHelper
at com.mface.mcall.ui.base.BaseActivity.onCreate(BaseActivity.java:99)
at com.mface.mcall.ui.splash.SplashActivity.onCreate(SplashActivity.java:36)
at android.app.Activity.performCreate(Activity.java:5203)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2078)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2139)
at android.app.ActivityThread.access$700(ActivityThread.java:143)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4960)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
这是activityhelper的初始化部分
public ActivityHelper(Context context, GlobalActionsListener actionsListener) {
super(context);
this.actionsListener = actionsListener;
activity = (Activity) context;
Log.d(TAG,activity.toString());
activityUIHelper = new ActivityUIHelper(activity);
}
这是主要的build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
ext.compileSdkVersion = 21
ext.buildToolsVersion = '21.1.2'
ext.minSdkVersion = 14
ext.targetSdkVersion = 21
ext.versionName = '1.0'
ext.versionCode = 25
ext.prodDebug = false
ext.devDebug = true
// Dependencies versions
ext.universalImageLoaderVersion = '1.9.3'
ext.googlePlayServicesVersion = '6.1.+'
ext.croutonVersion = '1.8.4'
ext.cropperVersion = '0.9.10'
ext.viewPagerIndicatorVersion = '2.4.1'
ext.picassoVersion = '2.4.0'
ext.guavaVersion = '18.0'
ext.roundedImageViewVersion = '1.1.0'
ext.stickyListHeadersVersion = '2.5.2'
ext.FButtonVersion ='1.0.5'
ext.croutonVersion = '1.8.5'
这是应用程序的gradle
buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'com.android.application'
//apply plugin: 'crashlytics'
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':Q-municate_core')
compile "com.google.android.gms:play-services:${rootProject.googlePlayServicesVersion}"
compile "com.soundcloud.android:android-crop:${rootProject.cropperVersion}@aar"
compile "com.nostra13.universalimageloader:universal-image-loader:${rootProject.universalImageLoaderVersion}"
compile "fr.avianey.com.viewpagerindicator:library:${rootProject.viewPagerIndicatorVersion}@aar"
compile group: 'com.squareup.picasso', name: 'picasso', version: "${rootProject.picassoVersion}"
compile "com.google.guava:guava:${rootProject.guavaVersion}"
compile "com.makeramen:roundedimageview-apklib:${rootProject.roundedImageViewVersion}"
compile "se.emilsjolander:stickylistheaders:${rootProject.stickyListHeadersVersion}"
compile "info.hoang8f:fbutton:${rootProject.FButtonVersion}"
compile "de.keyboardsurfer.android.widget:crouton:${rootProject.croutonVersion}@aar"
compile 'com.android.support:appcompat-v7:21.0.3'
//compile 'com.android.support:support-v4:21.0.3'
compile 'com.nineoldandroids:library:2.4.0'
}
android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion rootProject.buildToolsVersion
defaultConfig {
applicationId 'com.mface.mcall'
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
lintOptions {
abortOnError false
}
}
尝试构建,从A.Studio菜单和命令行中清除。没有帮助!
没有构建错误,但应用程序崩溃了。这是我第一个使用gradle和A.Studio的项目,事情并不乐观:(