Mi aplicación no funciona en KK, se detiene cuando la abro, dejo aquí el logcat:
01-30 16:38:36.122 13983-13983/? E/cutils-trace: Error opening trace file: No such file or directory (2)
01-30 16:38:36.296 13983-13983/? E/memtrack: Couldn't load memtrack module (No such file or directory)
01-30 16:38:36.296 13983-13983/? E/android.os.Debug: failed to load memtrack module: -2
01-30 16:38:37.158 13996-13996/? E/cutils-trace: Error opening trace file: No such file or directory (2)
01-30 16:38:37.330 13996-13996/? E/memtrack: Couldn't load memtrack module (No such file or directory)
01-30 16:38:37.330 13996-13996/? E/android.os.Debug: failed to load memtrack module: -2
01-30 16:38:45.187 14007-14007/? E/cutils-trace: Error opening trace file: No such file or directory (2)
01-30 16:38:45.356 14007-14007/? E/memtrack: Couldn't load memtrack module (No such file or directory)
01-30 16:38:45.356 14007-14007/? E/android.os.Debug: failed to load memtrack module: -2
01-30 16:38:46.239 14025-14025/? E/cutils-trace: Error opening trace file: No such file or directory (2)
01-30 16:38:46.407 14025-14025/? E/memtrack: Couldn't load memtrack module (No such file or directory)
01-30 16:38:46.407 14025-14025/? E/android.os.Debug: failed to load memtrack module: -2
01-30 16:38:46.509 14025-14031/? E/jdwp: jdwp::setsockopt(SO_SNDTIMEO)
01-30 16:38:46.509 14025-14031/? E/jdwp: jdwp::setsockopt(SO_RCVTIMEO)
01-30 16:38:46.606 14035-14035/? E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
01-30 16:38:47.985 14035-14035/vrteam.technophonecs E/AndroidRuntime: FATAL EXCEPTION: main
Process: otrointento.dos, PID: 14035
java.lang.NoSuchMethodError: android.view.Window.setNavigationBarColor
at otrointento.dos.descubre_Activity.onCreate(descubre_Activity.java:57)
at android.app.Activity.performCreate(Activity.java:5264)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5299)
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:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(Native Method)
Por lo que puedo entender el error está en la clase descubre_activity pero no sé como solucionarlo, por que no sé el error real, dejo la clase aquí por si alguien puede ayudarme, gracias
descubre_activity:
import android.Manifest;
import android.app.ActionBar;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.content.Intent;
import android.widget.ImageButton;
public class descubre_Activity extends AppCompatActivity {
ImageButton btn1;
ImageButton btn2;
ImageButton btn3;
ImageButton btn4;
ImageButton btn5;
ImageButton icon_des1;
ImageButton icon_des2;
ImageButton icon_des3;
ImageButton icon_des4;
ImageButton icon_des5;
ImageButton icon_des6;
ImageButton icon_work1;
ImageButton icon_work2;
ImageButton icon_work3;
ImageButton icon_work4;
ImageButton icon_work5;
final int MY_PERMISSIONS_REQUEST_CALL_PHONE = 10;
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
switch (requestCode) {
case MY_PERMISSIONS_REQUEST_CALL_PHONE : {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// PERMISO CONCEDIDO, procede a realizar lo que tienes que hacer
Intent i = new Intent(Intent.ACTION_CALL, Uri.parse("tel:00000000"));
startActivity(i);
} else {
// PERMISO DENEGADO
}
return;
}
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.descubre_main);
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
getSupportActionBar().setCustomView(R.layout.text_des);
getWindow().setNavigationBarColor(getResources().getColor(R.color.colorbarra_inf));
btn1 = (ImageButton) findViewById(R.id.btn1);
btn2 = (ImageButton) findViewById(R.id.btn2);
btn3 = (ImageButton) findViewById(R.id.btn3);
btn4 = (ImageButton) findViewById(R.id.btn4);
btn5 = (ImageButton) findViewById(R.id.btn5);
icon_des1 = (ImageButton) findViewById(R.id.icon_des1);
icon_des2 = (ImageButton) findViewById(R.id.icon_des2);
icon_des3 = (ImageButton) findViewById(R.id.icon_des3);
icon_des4 = (ImageButton) findViewById(R.id.icon_des4);
icon_des5 = (ImageButton) findViewById(R.id.icon_des5);
icon_des6 = (ImageButton) findViewById(R.id.icon_des6);
icon_work1 = (ImageButton) findViewById(R.id.icon_work1);
icon_work2 = (ImageButton) findViewById(R.id.icon_work2);
icon_work3 = (ImageButton) findViewById(R.id.icon_work3);
icon_work4 = (ImageButton) findViewById(R.id.icon_work4);
icon_work5 = (ImageButton) findViewById(R.id.icon_work5);
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent boton1 = new Intent(descubre_Activity.this, descubre_Activity.class);
startActivity(boton1);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
});
btn2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent boton2 = new Intent(descubre_Activity.this, reparar_Activity.class);
startActivity(boton2);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
});
btn3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent boton3 = new Intent(descubre_Activity.this, smartphones_Activity.class);
startActivity(boton3);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
});
btn4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent boton4 = new Intent(descubre_Activity.this, iphone_Activity.class);
startActivity(boton4);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
});
btn5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent boton5 = new Intent(descubre_Activity.this, diseno_Activity.class);
startActivity(boton5);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
});
icon_des1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri uriUrl = Uri.parse("https://www.google.es");
Intent intent = new Intent(Intent.ACTION_VIEW, uriUrl);
startActivity(intent);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
});
icon_des2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri uriUrl = Uri.parse("https://www.google.es");
Intent intent = new Intent(Intent.ACTION_VIEW, uriUrl);
startActivity(intent);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
});
icon_des3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri uriUrl = Uri.parse("https://www.google.es");
Intent intent = new Intent(Intent.ACTION_VIEW, uriUrl);
startActivity(intent);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
});
icon_des4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent icon_des4 = new Intent(descubre_Activity.this, gmail_Activity.class);
startActivity(icon_des4);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
});
icon_des5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(ActivityCompat.checkSelfPermission(descubre_Activity.this, Manifest.permission.CALL_PHONE) == PackageManager.PERMISSION_GRANTED){
// Aquí ya está concedido, procede a realizar lo que tienes que hacer
Intent i = new Intent(Intent.ACTION_CALL, Uri.parse("tel:00000000"));
startActivity(i);
}else{
// Aquí lanzamos un dialog para que el usuario confirme si permite o no el realizar llamadas
ActivityCompat.requestPermissions(descubre_Activity.this, new String[]{ Manifest.permission.CALL_PHONE}, MY_PERMISSIONS_REQUEST_CALL_PHONE);
}
}
});
icon_des6.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri uriUrl = Uri.parse("https://www.google.es");
Intent intent = new Intent(Intent.ACTION_VIEW, uriUrl);
startActivity(intent);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
});
icon_work1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent work1 = new Intent(descubre_Activity.this, work1Activity.class);
startActivity(work1);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
});
icon_work2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent work2 = new Intent(descubre_Activity.this, work2Activity.class);
startActivity(work2);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
});
icon_work3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent work3 = new Intent(descubre_Activity.this, work3Activity.class);
startActivity(work3);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
});
icon_work4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent work4 = new Intent(descubre_Activity.this, work4Activity.class);
startActivity(work4);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
});
icon_work5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent work5 = new Intent(descubre_Activity.this, work5Activity.class);
startActivity(work5);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
});
}
}