solucionar responde porque ninguna mis los juegos google funcionar funciona dejan cómo celular carga aplicaciones aplicacion abre android git android-gradle multidex android-multidex

android - responde - porque mis aplicaciones dejan de funcionar



¿Por qué el uso de multiDexEnabled(verdadero) permite que la aplicación se cree pero se bloquea constantemente? (4)

Una aplicación en la que estoy trabajando (código base no escrito por mí, que contiene una cantidad de libs grandes que no se pueden eliminar). En una ejecución reciente, comenzó a responder con el mensaje:

Esto solo ocurre cuando la aplicación intenta compilar cuando se usa la flecha de ejecución, se compila correctamente cuando se llama a "reconstruir" o "limpiar".

Una solución incluida en línea es usar multiDexEnabled true ( documentación de multiDex aquí ).

Usando esto pude obtener el edificio con la flecha "Ejecutar" y "reconstruir". Sin embargo, la aplicación creada y ejecutada en el teléfono se bloquea con el siguiente mensaje de error:

12-11 16:17:16.963 28868-28868/? D/dalvikvm: Late-enabling CheckJNI 12-11 16:17:17.023 28868-28868/com.myname.myappcoop W/dalvikvm: VFY: unable to resolve static field 10471 (common_google_play_services_updating_text) in Lcom/google/android/gms/R$string; 12-11 16:17:17.023 28868-28868/com.myname.myappcoop D/dalvikvm: VFY: replacing opcode 0x60 at 0x0021 12-11 16:17:17.023 28868-28868/com.myname.myappcoop I/dalvikvm: DexOpt: unable to optimize static field ref 0x28e8 at 0x2e in Lcom/google/android/gms/common/GoogleApiAvailability;.zza 12-11 16:17:17.033 28868-28868/com.myname.myappcoop W/dalvikvm: VFY: unable to resolve static field 10465 (common_google_play_services_unknown_issue) in Lcom/google/android/gms/R$string; 12-11 16:17:17.033 28868-28868/com.myname.myappcoop D/dalvikvm: VFY: replacing opcode 0x60 at 0x0012 12-11 16:17:17.033 28868-28868/com.myname.myappcoop W/dalvikvm: VFY: unable to resolve static field 10462 (common_google_play_services_notification_ticker) in Lcom/google/android/gms/R$string; 12-11 16:17:17.033 28868-28868/com.myname.myappcoop D/dalvikvm: VFY: replacing opcode 0x60 at 0x0013 12-11 16:17:17.033 28868-28868/com.myname.myappcoop W/dalvikvm: VFY: unable to resolve static field 10437 (common_ic_googleplayservices) in Lcom/google/android/gms/R$drawable; 12-11 16:17:17.033 28868-28868/com.myname.myappcoop D/dalvikvm: VFY: replacing opcode 0x60 at 0x0039 12-11 16:17:17.033 28868-28868/com.myname.myappcoop W/dalvikvm: VFY: unable to resolve static field 10462 (common_google_play_services_notification_ticker) in Lcom/google/android/gms/R$string; 12-11 16:17:17.033 28868-28868/com.myname.myappcoop D/dalvikvm: VFY: replacing opcode 0x60 at 0x0099 12-11 16:17:17.043 28868-28868/com.myname.myappcoop I/dalvikvm: Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zzj 12-11 16:17:17.043 28868-28868/com.myname.myappcoop W/dalvikvm: VFY: unable to resolve virtual method 616: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller; 12-11 16:17:17.043 28868-28868/com.myname.myappcoop D/dalvikvm: VFY: replacing opcode 0x6e at 0x000b 12-11 16:17:17.043 28868-28868/com.myname.myappcoop I/dalvikvm: DexOpt: unable to optimize static field ref 0x28c4 at 0x6c in Lcom/google/android/gms/common/GooglePlayServicesUtil;.zza 12-11 16:17:17.043 28868-28868/com.myname.myappcoop I/dalvikvm: DexOpt: unable to optimize static field ref 0x28e9 at 0x6e in Lcom/google/android/gms/common/GooglePlayServicesUtil;.zza 12-11 16:17:17.083 28868-28907/com.myname.myappcoop I/GMPM: App measurement is starting up 12-11 16:17:17.083 28868-28907/com.myname.myappcoop E/GMPM: getGoogleAppId failed with status: 10 12-11 16:17:17.083 28868-28907/com.myname.myappcoop E/GMPM: Uploading is not possible. App measurement disabled 12-11 16:17:17.113 28868-28868/com.myname.myappcoop D/dalvikvm: GC_FOR_ALLOC freed 358K, 3% free 16887K/17276K, paused 11ms, total 12ms 12-11 16:17:17.133 28868-28868/com.myname.myappcoop W/dalvikvm: VFY: unable to resolve static field 8714 (static_string) in Lcom/myname/display/R$string; 12-11 16:17:17.133 28868-28868/com.myname.myappcoop D/dalvikvm: VFY: replacing opcode 0x60 at 0x000b 12-11 16:17:17.133 28868-28868/com.myname.myappcoop W/dalvikvm: VFY: unable to resolve static field 8710 (static_string2) in Lcom/myname/display/R$string; 12-11 16:17:17.133 28868-28868/com.myname.myappcoop D/dalvikvm: VFY: replacing opcode 0x60 at 0x000e 12-11 16:17:17.133 28868-28868/com.myname.myappcoop W/dalvikvm: VFY: unable to resolve static field 8711 (static_string3) in Lcom/myname/display/R$string; 12-11 16:17:17.133 28868-28868/com.myname.myappcoop D/dalvikvm: VFY: replacing opcode 0x60 at 0x0011 12-11 16:17:17.133 28868-28868/com.myname.myappcoop W/dalvikvm: VFY: unable to resolve static field 8716 (static_string4) in Lcom/myname/display/R$string; 12-11 16:17:17.133 28868-28868/com.myname.myappcoop D/dalvikvm: VFY: replacing opcode 0x60 at 0x0014 12-11 16:17:17.133 28868-28868/com.myname.myappcoop W/dalvikvm: VFY: unable to resolve static field 8717 (static_string5) in Lcom/myname/display/R$string; 12-11 16:17:17.133 28868-28868/com.myname.myappcoop D/dalvikvm: VFY: replacing opcode 0x60 at 0x0017 12-11 16:17:17.133 28868-28868/com.myname.myappcoop W/dalvikvm: VFY: unable to resolve static field 8721 (static_string6) in Lcom/myname/display/R$string; 12-11 16:17:17.133 28868-28868/com.myname.myappcoop D/dalvikvm: VFY: replacing opcode 0x60 at 0x001a 12-11 16:17:17.133 28868-28868/com.myname.myappcoop W/dalvikvm: VFY: unable to resolve static field 8720 (static_string7) in Lcom/myname/display/R$string; 12-11 16:17:17.133 28868-28868/com.myname.myappcoop D/dalvikvm: VFY: replacing opcode 0x60 at 0x001d 12-11 16:17:17.133 28868-28868/com.myname.myappcoop W/dalvikvm: VFY: unable to resolve static field 8719 (static_string8) in Lcom/myname/display/R$string; 12-11 16:17:17.133 28868-28868/com.myname.myappcoop D/dalvikvm: VFY: replacing opcode 0x60 at 0x0020 12-11 16:17:17.143 28868-28868/com.myname.myappcoop D/MAIN: Context 1 : com.myname.myapp.Application@4268dfe8 12-11 16:17:17.163 28868-28868/com.myname.myappcoop E/dalvikvm: Could not find class ''com.myname.myapp.view.FalseActionBar$1'', referenced from method com.myname.myapp.view.FalseActionBar.initializeView 12-11 16:17:17.163 28868-28868/com.myname.myappcoop W/dalvikvm: VFY: unable to resolve new-instance 3015 (Lcom/myname/myapp/view/FalseActionBar$1;) in Lcom/myname/myapp/view/FalseActionBar; 12-11 16:17:17.163 28868-28868/com.myname.myappcoop D/dalvikvm: VFY: replacing opcode 0x22 at 0x002a 12-11 16:17:17.163 28868-28868/com.myname.myappcoop W/dalvikvm: VFY: unable to resolve static field 10366 ($SwitchMap$com$myname$myapp$view$FalseActionBar$TitleMode) in Lcom/myname/myapp/view/FalseActionBar$3; 12-11 16:17:17.163 28868-28868/com.myname.myappcoop D/dalvikvm: VFY: replacing opcode 0x62 at 0x0005 12-11 16:17:17.163 28868-28868/com.myname.myappcoop D/dalvikvm: DexOpt: unable to opt direct call 0x5db9 at 0x2c in Lcom/myname/myapp/view/FalseActionBar;.initializeView 12-11 16:17:17.163 28868-28868/com.myname.myappcoop D/dalvikvm: DexOpt: unable to opt direct call 0x5dba at 0x46 in Lcom/myname/myapp/view/FalseActionBar;.initializeView 12-11 16:17:17.163 28868-28868/com.myname.myappcoop D/AndroidRuntime: Shutting down VM 12-11 16:17:17.163 28868-28868/com.myname.myappcoop W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x4162fba8) 12-11 16:17:17.163 28868-28868/com.myname.myappcoop E/AndroidRuntime: FATAL EXCEPTION: main Process: com.myname.myappcoop, PID: 28868 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myname.myappcoop/com.myname.myapp.MainActivity}: android.view.InflateException: Binary XML file line #24: Error inflating class com.myname.myapp.view.FalseActionBar at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) at android.app.ActivityThread.access$800(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5001) 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:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method) Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class com.myname.myapp.view.FalseActionBar at android.view.LayoutInflater.createView(LayoutInflater.java:620) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at android.view.LayoutInflater.inflate(LayoutInflater.java:353) at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290) at android.app.Activity.setContentView(Activity.java:1929) at com.myname.myapp.MainActivity.onCreate(MainActivity.java:96) at android.app.Activity.performCreate(Activity.java:5231) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)  at android.app.ActivityThread.access$800(ActivityThread.java:135)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5001)  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:785)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)  at dalvik.system.NativeStart.main(Native Method)  Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at android.view.LayoutInflater.createView(LayoutInflater.java:594) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)  at android.view.LayoutInflater.inflate(LayoutInflater.java:492)  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)  at android.view.LayoutInflater.inflate(LayoutInflater.java:353)  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)  at android.app.Activity.setContentView(Activity.java:1929)  at com.myname.myapp.MainActivity.onCreate(MainActivity.java:96)  at android.app.Activity.performCreate(Activity.java:5231)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)  at android.app.ActivityThread.access$800(ActivityThread.java:135)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5001)  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:785)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)  at dalvik.system.NativeStart.main(Native Method)  Caused by: java.lang.NoClassDefFoundError: com.myname.myapp.view.FalseActionBar$1 at com.myname.myapp.view.FalseActionBar.initializeView(FalseActionBar.java:61) at com.myname.myapp.view.FalseActionBar.<init>(FalseActionBar.java:46) at java.lang.reflect.Constructor.constructNative(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)  at android.view.LayoutInflater.createView(LayoutInflater.java:594)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)  at android.view.LayoutInflater.inflate(LayoutInflater.java:492)  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)  at android.view.LayoutInflater.inflate(LayoutInflater.java:353)  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)  at android.app.Activity.setContentView(Activity.java:1929)  at com.myname.myapp.MainActivity.onCreate(MainActivity.java:96)  at android.app.Activity.performCreate(Activity.java:5231)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)  at android.app.ActivityThread.access$800(ActivityThread.java:135)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5001)  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:785)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)  at dalvik.system.NativeStart.main(Native Method)  12-11 16:17:46.173 28868-28868/? I/Process: Sending signal. PID: 28868 SIG: 9

El lugar donde se bloquea el código (causado por: java.lang.NoClassDefFoundError: com.myname.myapp.view.FalseActionBar $ 1) es cuando se declara un oyente. Originalmente estaba en otra clase que se extendía en el detector de clics, así que lo introduje en el código, pero eso no ayudó.

title.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { switch (mode) { case NONE: //Nothing! break; case BACK: if(delegate != null){ delegate.goBack(backLocation); } break; case HOME: if(delegate != null){ delegate.goHome(); } break; } }

Originalmente pensé que el problema era con el inflador, aunque ahora estoy bastante seguro de que debe ser con el uso de MultiDex.

¿Qué está haciendo multiDex que está causando la caída de la inflación?


Espero que estés usando Android Studio. Trate de agregar esta línea también al archivo de gradle y vuelva a probar el mismo

dexOptions { javaMaxHeapSize "4g" }


Solo agrega

android:name="android.support.multidex.MultiDexApplication"

en AndroidManifest.xml en la application XM tag como propiedad.

Esto solucionará todos tus problemas.


tienes que hacer lo siguiente

  1. en build.gradle add

    dexOptions { javaMaxHeapSize "4g" }

  2. habilitar multidex

    defaultConfig { multiDexEnabled true }

  3. Cree un archivo extendido con MultiDexApplication como sigue

    public class App extends MultiDexApplication { @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); } }

    y haga esta clase de ''Aplicación'' como clase de aplicación en el manifiesto como se muestra abajo:

    <application android:name=".activity.App"