Skip to main content
3 de 4
Añadidos todos los archivos relacionados con MainActivity

Crash al usar Proguard con JACK

Estoy probando Jack en android studio puedo generar el app-release.apk con este build.gradle sin problema, pero a la hora de ejecutarla crashea:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"
    defaultConfig {
        applicationId "com.my.personal.project"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    jackOptions {
        enabled true
    }
}
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
testCompile 'junit:junit:4.12'
}

Si desactivo minify no hay ningun fallo, pero el apk pasa a ocupar mas del doble de tamaño...

añado logcat:

E/AndroidRuntime: FATAL EXCEPTION: main
                                               Process: com.my.personal.project, PID: 19382
                                               java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.personal.project/com.my.personal.project.MainActivity}: android.view.InflateException: Binary XML file line #16: Binary XML file line #16: Error inflating class android.support.design.widget.NavigationView
                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3253)
                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
                                                   at android.app.ActivityThread.access$1100(ActivityThread.java:221)
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
                                                   at android.os.Handler.dispatchMessage(Handler.java:102)
                                                   at android.os.Looper.loop(Looper.java:158)
                                                   at android.app.ActivityThread.main(ActivityThread.java:7225)
                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
                                                Caused by: android.view.InflateException: Binary XML file line #16: Binary XML file line #16: Error inflating class android.support.design.widget.NavigationView
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
                                                   at android.support.v7.c.af.o(Unknown Source)
                                                   at android.support.v7.c.a.setContentView(Unknown Source)
                                                   at com.my.personal.project.MainActivity.onCreate(Unknown Source)
                                                   at android.app.Activity.performCreate(Activity.java:6876)
                                                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)
                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
                                                   at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
                                                   at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                   at android.os.Looper.loop(Looper.java:158) 
                                                   at android.app.ActivityThread.main(ActivityThread.java:7225) 
                                                   at java.lang.reflect.Method.invoke(Native Method) 
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                                                Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class android.support.design.widget.NavigationView
                                                   at android.view.LayoutInflater.createView(LayoutInflater.java:657)
                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
                                                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:847)
                                                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:527)
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
                                                   at android.support.v7.c.af.o(Unknown Source) 
                                                   at android.support.v7.c.a.setContentView(Unknown Source) 
                                                   at com.my.personal.project.MainActivity.onCreate(Unknown Source) 
                                                   at android.app.Activity.performCreate(Activity.java:6876) 
                                                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) 
                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
                                                   at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
                                                   at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                   at android.os.Looper.loop(Looper.java:158) 
                                                   at android.app.ActivityThread.main(ActivityThread.java:7225) 
                                                   at java.lang.reflect.Method.invoke(Native Method) 
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                                                Caused by: java.lang.reflect.InvocationTargetException
                                                   at java.lang.reflect.Constructor.newInstance(Native Method)
                                                   at android.view.LayoutInflater.createView(LayoutInflater.java:631)
                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776) 
                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
                                                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:847) 
                                                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:527) 
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
                                                   at android.support.v7.c.af.o(Unknown Source) 
                                                   at android.support.v7.c.a.setContentView(Unknown Source) 
                                                   at com.my.personal.project.MainActivity.onCreate(Unknown Source) 
                                                   at android.app.Activity.performCreate(Activity.java:6876) 
                                                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) 
                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
                                                   at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
                                                   at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                   at android.os.Looper.loop(Looper.java:158) 
                                                   at android.app.ActivityThread.main(ActivityThread.java:7225) 
                                                   at java.lang.reflect.Method.invoke(Native Method) 
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                                                Caused by: android.view.InflateException: Binary XML file line #17: Binary XML file line #17: Error inflating class android.support.design.internal.NavigationMenuView
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
                                                   at android.support.design.internal.c.b(Unknown Source)
                                                   at android.support.design.widget.NavigationView.<init>(Unknown Source)
                                                   at android.support.design.widget.NavigationView.<init>(Unknown Source)
                                                   at java.lang.reflect.Constructor.newInstance(Native Method) 
                                                   at android.view.LayoutInflater.createView(LayoutInflater.java:631) 
                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776) 
                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
                                                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:847) 
                                                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:527) 
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
                                                   at android.support.v7.c.af.o(Unknown Source) 
                                                   at android.support.v7.c.a.setContentView(Unknown Source) 
                                                   at com.my.personal.project.MainActivity.onCreate(Unknown Source) 
                                                   at android.app.Activity.performCreate(Activity.java:6876) 
                                                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) 
                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
                                                   at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
                                                   at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                   at android.os.Looper.loop(Looper.java:158) 
                                                   at android.app.ActivityThread.main(ActivityThread.java:7225) 
                                                   at java.lang.reflect.Method.invoke(Native Method) 
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                                                Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class android.support.design.internal.NavigationMenuView
                                                   at android.view.LayoutInflater.createView(LayoutInflater.java:657)
                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
                                                   at android.support.design.internal.c.b(Unknown Source) 
                                                   at android.support.design.widget.NavigationView.<init>(Unknown Source) 
                                                   at android.support.design.widget.NavigationView.<init>(Unknown Source) 
                                                   at java.lang.reflect.Constructor.newInstance(Native Method) 
                                                   at android.view.LayoutInflater.createView(LayoutInflater.java:631) 
                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776) 
                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
                                                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:847) 
                                                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:527) 
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
                                                   at android.support.v7.c.af.o(Unknown Source) 
                                                   at android.support.v7.c.a.setContentView(Unknown Source) 
                                                   at com.my.personal.project.MainActivity.onCreate(Unknown Source) 
                                                   at android.app.Activity.performCreate(Activity.java:6876) 
                                                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) 
                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
                                                   at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
                                                   at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                   at android.os.Looper.loop(Looper.java:158) 
                                                   at android.app.ActivityThread.main(ActivityThread.java:7225) 
                                                   at java.lang.reflect.Method.invoke(Native Method) 
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                                                Caused by: java.lang.reflect.InvocationTargetException
                                                   at java.lang.reflect.Constructor.newInstance(Native Method)
                                                   at android.view.LayoutInflater.createView(LayoutInflater.java:631)
                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776) 
                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
                                                   at android.support.design.internal.c.b(Unknown Source) 
                                                   at android.support.design.widget.NavigationView.<init>(Unknown Source) 
                                                   at android.support.design.widget.NavigationView.<init>(Unknown Source) 
                                                   at java.lang.reflect.Constructor.newInstance(Native Method) 
                                                   at android.view.LayoutInflater.createView(LayoutInflater.java:631) 
                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776) 
                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
                                                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:847) 
                                                   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:527) 
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
                                                   at android.support.v7.c.af.o(Unknown Source) 
                                                   at android.support.v7.c.a.setContentView(Unknown Source) 
                                                   at com.my.personal.project.MainActivity.onCreate(Unknown Source) 
                                                   at android.app.Activity.performCreate(Activity.java:6876) 
                                                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135) 
                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206) 
                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
                                                   at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
                                                   at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                   at android.os.Looper.loop(Looper.java:158) 
                                                   at android.app.ActivityThread.main(ActivityThread.java:7225) 
                                                   at java.lang.reflect.Method.invoke(Native Method) 
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                                                Caused by: java.lang.VerifyError: Rejecting class android.support.v7.widget.r because it failed compile-time verification (declaration of 'android.support.v7.widget.r' appears in /data/app/com.my.personal.project-2/base.apk)
                                                   at android.support.v7.widget.bw.<init>(Unknown Source)
                                                   at android.support.design.internal.NavigationMenuView.<init>(Unknown Source)
                                                at and

activity_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout     xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">

    <include
        layout="@layout/app_bar_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header_main"
        app:menu="@menu/activity_main_drawer" />

</android.support.v4.widget.DrawerLayout>

app_bar_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="com.my.personal.project.MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

       <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_main" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        app:srcCompat="@android:drawable/ic_dialog_email" />

</android.support.design.widget.CoordinatorLayout>

content_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/content_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="com.my.personal.project.MainActivity"
    tools:showIn="@layout/app_bar_main">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerVertical="true"
        android:gravity="center"
        android:layout_centerHorizontal="true"
        android:layout_alignParentTop="true"
        android:id="@+id/content_frame"/>

</RelativeLayout>

nav_header_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="@dimen/nav_header_height"
    android:background="@drawable/side_nav_bar"
    android:gravity="bottom"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:theme="@style/ThemeOverlay.AppCompat.Dark">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/nav_header_vertical_spacing"
        app:srcCompat="@android:drawable/sym_def_app_icon" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/nav_header_vertical_spacing"
        android:text="Android Studio"
        android:textAppearance="@style/TextAppearance.AppCompat.Body1" />

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="[email protected]" />

</LinearLayout>