java.lang.VerifyError仅在发布APK中

时间:2015-03-24 01:22:39

标签: java android

我一直在尝试诊断和处理已经弹出的错误,但仅限于已签名的发布APK。现在已经4天了,我似乎无法弄清问题是什么。我发现的只是可怕的java.lang.VerifyError。任何帮助将非常感激。

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.name"
android:versionCode="5"
android:versionName="1.4" >
<uses-permission
    android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission
    android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission
    android:name="android.permission.READ_INTERNAL_STORAGE"/>
<uses-permission
    android:name="android.permission.INTERACT_ACROSS_USERS_FULL"/>
<uses-permission
    android:name="android.permission.INTERNET"/>
<uses-permission
    android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission
    android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission
    android:name="android.permission.READ_CONTACTS"/>
<uses-permission
    android:name="android.permission.SEND_SMS"/>
<uses-permission
    android:name="android.permission.READ_MMS"/>
<uses-permission 
android:name="android.permission.READ_SMS"/>
<uses-permission
    android:name="android.permission.BILLING"/>
<uses-permission
    android:name="com.android.vending.BILLING"/>

<uses-sdk
    android:minSdkVersion="19"
    android:targetSdkVersion="21" />


<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="Name"
    android:debuggable="true"
    android:theme="@style/Theme.Bluetheme" >
    <service
        android:name="com.appnext.appnextsdk.DownloadService"/>
    <service
        android:name="com.ironsource.mobilcore.MobileCoreReport"
        android:enabled="true"
        android:exported="false"
        android:process=":mcServiceProcess">
        </service>
    <receiver
        android:name="com.appnext.appnextsdk.ReferralReceiver">
        android:exported="true"
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER">           </action>
    </intent-filter>
        </receiver>
    <receiver
        android:name="com.ironsource.mobilcore.InstallationTracker"
        android:enabled="true"
        android:process=":installationTracker">
        </receiver>
    <activity
        android:name=".MainActivity"
        android:screenOrientation="portrait"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".Stats"
        android:screenOrientation="portrait"
        android:label="Statistics" >
     </activity>
    <activity
    android:name=".IncomeOptions"
    android:screenOrientation="portrait"
    android:label="Settings">
</activity>
    <activity
        android:name=".CreatePDF"
        android:screenOrientation="portrait"
        android:label="Create PDF">
    </activity>
    <activity
        android:name=".EmailOptions"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustResize|stateHidden"
        android:label="Send Email">
    </activity>
    <activity
        android:name=".SMSOptions"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustResize|stateHidden"
        android:label="Send Text">
    </activity>
    <activity
        android:name=".ExportOptions"
        android:screenOrientation="portrait"
        android:label="Export Options">
    </activity>
    <activity
        android:name=".Paycheck"
        android:screenOrientation="portrait"
        android:label="Pay Report">
    </activity>
</application>

logCat

Process: com.name, PID: 24154
java.lang.VerifyError: com/name/Stats
        at java.lang.Class.newInstanceImpl(Native Method)
        at java.lang.Class.newInstance(Class.java:1208)
        at android.app.Instrumentation.newActivity(Instrumentation.java:1079)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2222)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
        at android.app.ActivityThread.access$900(ActivityThread.java:161)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:157)
        at android.app.ActivityThread.main(ActivityThread.java:5356)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
        at dalvik.system.NativeStart.main(Native Method)

我也有一些库,所以我也包括我的build.gradle。注意我修改了lintOptions,因为我需要包含调试以便弄清楚发生了什么。

 apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

lintOptions {
    checkReleaseBuilds false
}
defaultConfig {
    applicationId "com.name"
    minSdkVersion 19
    targetSdkVersion 21
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}
} 

dependencies {
compile 'com.android.support:support-v4:20.0.0'
compile 'com.android.support:appcompat-v7:20.0.0'
compile files('libs/appnextTrackingSDK.jar')
compile files('libs/AppnextSDK.jar')
compile files('libs/PdfViewer.jar')
compile files('libs/achartengine-1.1.0.jar')
compile files('libs/mobilecore.jar')
compile project(':caldroid')
}

再一次,任何帮助都会令人难以置信。似乎我已经尝试了所有的东西,但没有任何东西适合我的特定情况。

1 个答案:

答案 0 :(得分:0)

终于弄清楚发生了什么!我从清单中取出了android.permission.BILLING,android.permission.READ_CONTACTS和android.permission.GET_ACCOUNTS,并将compileSDKVersion和targetSDKVersion更改为20,将buildTools更改为版本20,将minSDKVersion更改为16,并通过Android更新了所有内容SDK Manager。一旦我清理并重建,我就生成了一个发布版apk,一切都运行得很好。