Autore Topic: App chiede permessi di root e poi crasha  (Letto 458 volte)

Offline Solaire

  • Nuovo arrivato
  • *
  • Post: 4
  • Respect: 0
    • Mostra profilo
  • Dispositivo Android:
    Samsung Galaxy SII
App chiede permessi di root e poi crasha
« il: 16 Maggio 2014, 12:12:54 CEST »
0
Salve a tutti.

Posto qui il LogCat dell'esecuzione della mia app, la quale, dopo aver superato lo splash screen ed aver premuto il pulsante Gioca nell'activity del menu, cambia activity ma mi chiede i permessi di root per continuare. Che io dica di si o di no, l'app si blocca e poi crasha.


LogCat:

05-16 12:06:25.325: E/Trace(26752): error opening trace file: No such file or directory (2)
05-16 12:06:25.390: W/IconCustomizer(26752): can't load transform_config.xml
05-16 12:06:25.410: D/IconCustomizer(26752): Content Ratio = -1.0
05-16 12:06:25.410: D/IconCustomizer(26752): Generate customized icon for com.example.quizone_2.png
05-16 12:06:25.460: D/dalvikvm(26752): GC_CONCURRENT freed 182K, 16% free 6837K/8071K, paused 18ms+2ms, total 44ms
05-16 12:06:25.460: D/dalvikvm(26752): WAIT_FOR_CONCURRENT_GC blocked 26ms
05-16 12:06:25.535: I/themeservice(26752): add pending job /data/data/com.example.quizone_2/cache/com.example.quizone_2.png
05-16 12:06:25.550: I/themeservice(26752): binding service
05-16 12:06:25.600: D/dalvikvm(26752): GC_FOR_ALLOC freed 319K, 18% free 6855K/8263K, paused 16ms, total 16ms
05-16 12:06:25.680: I/dalvikvm-heap(26752): Grow heap (frag case) to 18.958MB for 11796752-byte allocation
05-16 12:06:25.735: D/dalvikvm(26752): GC_CONCURRENT freed 34K, 8% free 18340K/19847K, paused 13ms+8ms, total 53ms
05-16 12:06:26.140: D/dalvikvm(26752): GC_FOR_ALLOC freed 31K, 8% free 18308K/19847K, paused 15ms, total 15ms
05-16 12:06:26.240: I/dalvikvm-heap(26752): Grow heap (frag case) to 44.206MB for 26542672-byte allocation
05-16 12:06:26.275: D/dalvikvm(26752): GC_CONCURRENT freed <1K, 4% free 44229K/45831K, paused 12ms+3ms, total 38ms
05-16 12:06:26.690: I/themeservice(26752): service connected
05-16 12:06:26.690: I/themeservice(26752): saving icon for /data/data/com.example.quizone_2/cache/com.example.quizone_2.png
05-16 12:06:26.745: D/libEGL(26752): loaded /system/lib/egl/libEGL_mali.so
05-16 12:06:26.755: D/libEGL(26752): loaded /system/lib/egl/libGLESv1_CM_mali.so
05-16 12:06:26.765: D/libEGL(26752): loaded /system/lib/egl/libGLESv2_mali.so
05-16 12:06:26.770: D/(26752): Device driver API match
05-16 12:06:26.770: D/(26752): Device driver API version: 10
05-16 12:06:26.770: D/(26752): User space API version: 10
05-16 12:06:26.770: D/(26752): mali: REVISION=Linux-r2p4-02rel0 BUILD_DATE=Thu Oct 25 08:43:05 KST 2012
05-16 12:06:26.810: D/OpenGLRenderer(26752): Enabling debug mode 0
05-16 12:06:27.700: I/themeservice(26752): unbinding service
05-16 12:06:29.915: D/dalvikvm(26752): GC_FOR_ALLOC freed 11821K, 29% free 33647K/46919K, paused 18ms, total 19ms
05-16 12:06:29.960: D/dalvikvm(26752): GC_FOR_ALLOC freed 499K, 26% free 34750K/46919K, paused 13ms, total 14ms
05-16 12:06:30.005: D/dalvikvm(26752): GC_FOR_ALLOC freed 493K, 24% free 35857K/46919K, paused 13ms, total 13ms
05-16 12:06:31.275: I/Choreographer(26752): Skipped 69 frames!  The application may be doing too much work on its main thread.
05-16 12:06:32.210: I/Choreographer(26752): Skipped 55 frames!  The application may be doing too much work on its main thread.
05-16 12:06:32.395: E/SpannableStringBuilder(26752): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
05-16 12:06:32.775: D/dalvikvm(26752): GC_FOR_ALLOC freed 549K, 21% free 37080K/46919K, paused 25ms, total 28ms
05-16 12:06:32.820: D/dalvikvm(26752): GC_FOR_ALLOC freed 528K, 19% free 38248K/46919K, paused 14ms, total 14ms
05-16 12:06:32.850: D/dalvikvm(26752): GC_FOR_ALLOC freed 279K, 17% free 39057K/46919K, paused 13ms, total 13ms
05-16 12:06:32.885: D/dalvikvm(26752): GC_FOR_ALLOC freed 449K, 15% free 39983K/46919K, paused 14ms, total 14ms
05-16 12:06:32.910: D/dalvikvm(26752): GC_FOR_ALLOC freed 362K, 14% free 40436K/46919K, paused 13ms, total 13ms
05-16 12:06:32.985: D/dalvikvm(26752): GC_FOR_ALLOC freed <1K, 11% free 41965K/46919K, paused 14ms, total 14ms
05-16 12:06:32.985: I/dalvikvm-heap(26752): Forcing collection of SoftReferences for 3523144-byte allocation
05-16 12:06:33.005: D/dalvikvm(26752): GC_BEFORE_OOM freed 12K, 11% free 41952K/46919K, paused 22ms, total 22ms
05-16 12:06:33.005: E/dalvikvm-heap(26752): Out of memory on a 3523144-byte allocation.
05-16 12:06:33.005: I/dalvikvm(26752): "main" prio=5 tid=1 RUNNABLE
05-16 12:06:33.005: I/dalvikvm(26752):   | group="main" sCount=0 dsCount=0 obj=0x410fc508 self=0x410ec9b0
05-16 12:06:33.005: I/dalvikvm(26752):   | sysTid=26752 nice=0 sched=0/0 cgrp=apps handle=1075486512
05-16 12:06:33.005: I/dalvikvm(26752):   | schedstat=( 4684074370 1186823455 11292 ) utm=342 stm=126 core=0
05-16 12:06:33.005: I/dalvikvm(26752):   at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
05-16 12:06:33.010: I/dalvikvm(26752):   at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:625)
05-16 12:06:33.010: I/dalvikvm(26752):   at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:478)
05-16 12:06:33.010: I/dalvikvm(26752):   at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
05-16 12:06:33.010: I/dalvikvm(26752):   at android.content.res.Resources$Injector.createFromResourceStream(Resources.java:83)
05-16 12:06:33.010: I/dalvikvm(26752):   at android.content.res.Resources.loadDrawable(Resources.java:1963)
05-16 12:06:33.015: I/dalvikvm(26752):   at android.content.res.MiuiResources.loadDrawable(MiuiResources.java:326)
05-16 12:06:33.015: I/dalvikvm(26752):   at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
05-16 12:06:33.020: I/dalvikvm(26752):   at android.widget.ImageView.<init>(ImageView.java:120)
05-16 12:06:33.020: I/dalvikvm(26752):   at android.widget.ImageView.<init>(ImageView.java:110)
05-16 12:06:33.020: I/dalvikvm(26752):   at java.lang.reflect.Constructor.constructNative(Native Method)
05-16 12:06:33.025: I/dalvikvm(26752):   at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
05-16 12:06:33.030: I/dalvikvm(26752):   at android.view.LayoutInflater.createView(LayoutInflater.java:587)
05-16 12:06:33.035: I/dalvikvm(26752):   at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
05-16 12:06:33.035: I/dalvikvm(26752):   at com.android.internal.policy.impl.MiuiPhoneLayoutInflater.onCreateView(MiuiPhoneLayoutInflater.java:44)
05-16 12:06:33.035: I/dalvikvm(26752):   at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
05-16 12:06:33.035: I/dalvikvm(26752):   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
05-16 12:06:33.035: I/dalvikvm(26752):   at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
05-16 12:06:33.035: I/dalvikvm(26752):   at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
05-16 12:06:33.035: I/dalvikvm(26752):   at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
05-16 12:06:33.035: I/dalvikvm(26752):   at com.example.quizone_2.GameActivity$PlaceholderFragment.onCreateView(GameActivity.java:157)
05-16 12:06:33.035: I/dalvikvm(26752):   at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
05-16 12:06:33.035: I/dalvikvm(26752):   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:938)
05-16 12:06:33.035: I/dalvikvm(26752):   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
05-16 12:06:33.035: I/dalvikvm(26752):   at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
05-16 12:06:33.035: I/dalvikvm(26752):   at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
05-16 12:06:33.035: I/dalvikvm(26752):   at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
05-16 12:06:33.035: I/dalvikvm(26752):   at com.example.quizone_2.GameActivity.onStart(GameActivity.java:38)
05-16 12:06:33.040: I/dalvikvm(26752):   at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1178)
05-16 12:06:33.040: I/dalvikvm(26752):   at android.app.Activity.performStart(Activity.java:5216)
05-16 12:06:33.040: I/dalvikvm(26752):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2083)
05-16 12:06:33.040: I/dalvikvm(26752):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
05-16 12:06:33.040: I/dalvikvm(26752):   at android.app.ActivityThread.access$700(ActivityThread.java:140)
05-16 12:06:33.040: I/dalvikvm(26752):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
05-16 12:06:33.045: I/dalvikvm(26752):   at android.os.Handler.dispatchMessage(Handler.java:99)
05-16 12:06:33.045: I/dalvikvm(26752):   at android.os.Looper.loop(Looper.java:137)
05-16 12:06:33.045: I/dalvikvm(26752):   at android.app.ActivityThread.main(ActivityThread.java:4921)
05-16 12:06:33.045: I/dalvikvm(26752):   at java.lang.reflect.Method.invokeNative(Native Method)
05-16 12:06:33.045: I/dalvikvm(26752):   at java.lang.reflect.Method.invoke(Method.java:511)
05-16 12:06:33.050: I/dalvikvm(26752):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
05-16 12:06:33.050: I/dalvikvm(26752):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
05-16 12:06:33.050: I/dalvikvm(26752):   at dalvik.system.NativeStart.main(Native Method)
05-16 12:06:33.050: A/libc(26752): Fatal signal 11 (SIGSEGV) at 0x000002f8 (code=1), thread 26752 (ample.quizone_2)



Activity per la quale mi chiede i permessi di root (le uniche azioni che compio qui sono leggere dati da un database, cambiare il testo in alcune TexView e rendere visibili alcune ImageView):

Codice (Java): [Seleziona]
package com.example.quizone_2;

import java.io.IOException;

import android.content.SharedPreferences;
import android.database.SQLException;
import android.graphics.Color;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v7.app.ActionBarActivity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;

public class GameActivity extends ActionBarActivity {

        String[] info = new String[3];
       
        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_game);

                if (savedInstanceState == null) {
                        getSupportFragmentManager().beginTransaction()
                                        .add(R.id.container, new PlaceholderFragment()).commit();
                }
        }
       
        @Override
        public void onStart(){
                super.onStart();
               
                long n = Math.round((Math.random()*3)+1);
               
                DataBase myDbHelper = new DataBase(this);
        myDbHelper = new DataBase(this);
       
        myDbHelper.refresh();
 
        try {
 
                myDbHelper.createDataBase();
 
        } catch (IOException ioe) {
 
                throw new Error("NON HO CARICATO IL DATABASE TI PREGO SCUSAMI");
 
        }
 
        try {
 
                myDbHelper.openDataBase();
 
        }catch(SQLException sqle){
 
                throw sqle;
               
        }
   
        info = myDbHelper.getQuestion(n);
       
        TextView spiegazione = (TextView)findViewById(R.id.domanda);
                spiegazione.setText(info[1]);
               
        }
       
        @Override
        public void onResume(){
                super.onResume();
               
                // Controlla qual e il colore di sfondo nei settings e lo applica
        FrameLayout ll = (FrameLayout)findViewById(R.id.container);
               
                SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
                int bgc = Color.parseColor(sharedPref.getString("background_color", "#000000"));

                if(bgc == Color.BLACK){
                        TextView myTextView = (TextView)findViewById(R.id.domanda);
                        TextView r = (TextView)findViewById(R.id.risposta);
                        myTextView.setTextColor(Color.WHITE);
                        r.setTextColor(Color.GRAY);
                }
               
                ll.setBackgroundColor(bgc);
        }
       
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {

                // Inflate the menu; this adds items to the action bar if it is present.
                getMenuInflater().inflate(R.menu.game, menu);
                return true;
        }

        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
                // Handle action bar item clicks here. The action bar will
                // automatically handle clicks on the Home/Up button, so long
                // as you specify a parent activity in AndroidManifest.xml.
                int id = item.getItemId();
                if (id == R.id.action_settings) {
                        return true;
                }
                return super.onOptionsItemSelected(item);
        }

        public void rispostaVero(View view){
               
                if(info[2] == "1"){
                        ImageView v = (ImageView)findViewById(R.id.v);
                        v.setVisibility(View.VISIBLE);
                }else{
                        ImageView x = (ImageView)findViewById(R.id.x);
                        x.setVisibility(View.VISIBLE);
                       
                        TextView r = (TextView)findViewById(R.id.risposta);
                        r.setText(info[0]);
                        r.setVisibility(View.VISIBLE);
                }
               
        }
       
        public void rispostaFalso(View view){
               
                if(info[2] == "0"){
                        ImageView v = (ImageView)findViewById(R.id.v);
                        v.setVisibility(View.VISIBLE);
                }else{
                        ImageView x = (ImageView)findViewById(R.id.x);
                        x.setVisibility(View.VISIBLE);
                       
                        TextView r = (TextView)findViewById(R.id.risposta);
                        r.setText(info[0]);
                        r.setVisibility(View.VISIBLE);
                }
               
        }
       
        /**
         * A placeholder fragment containing a simple view.
         */

        public static class PlaceholderFragment extends Fragment {

                public PlaceholderFragment() {
                }

                @Override
                public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                Bundle savedInstanceState) {
                        View rootView = inflater.inflate(R.layout.fragment_game, container,
                                        false);
                        return rootView;
                }
        }

}
« Ultima modifica: 16 Maggio 2014, 14:23:54 CEST da Solaire »

Offline bradipao

  • Moderatore globale
  • Utente storico
  • *****
  • Post: 4043
  • keep it simple
  • Respect: +567
    • Github
    • Google+
    • bradipao
    • Mostra profilo
  • Dispositivo Android:
    Nexus 5
  • Play Store ID:
    Bradipao
  • Sistema operativo:
    W7
Re:App chiede permessi di root e poi crasha
« Risposta #1 il: 16 Maggio 2014, 13:40:29 CEST »
0
Prima cosa da fare, per rendere leggibili i post contenenti codice, è usare i marcatori per formattare java e xml. Sono nella barra della formattazione ().

Citazione
05-16 12:06:33.005: E/dalvikvm-heap(26752): Out of memory on a 3523144-byte allocation.

L'errore che il LogCat ti indica sembra essere un out of memory, usi immagini molto grandi?
Per prova, sostituisci quelle immagini con versioni molto piccole e verifica se si ripete il problema.

NON rispondo a domande nei messaggi privati
Bradipao @ Play Store