Ver mensagens sem resposta | Ver tópicos ativos Hoje é 10 Ago 2020, 06:48



Responder Tópico  [ 3 Mensagens ] 
 Problema ao executar app no celular 
Autor Mensagem
What is Android?
What is Android?

Data de registro: 27 Out 2018, 14:01
Mensagens: 2
Localização: São Paulo - Paulínia - Marília
Mensagem Problema ao executar app no celular
Prezados,

Estou criando telas do meu app (inicial, produto, etc).

Ao enviar o app (.apk) para meu celular (Samsung J7) o aplicativo dá um erro, e nunca inicia.

Segue o Logcat:
2018-10-27 12:54:19.977 2390-2390/? E/audit: type=1300 audit(1540652059.971:1890): arch=40000028 syscall=322 per=8 success=no exit=-13 a0=ffffff9c a1=ef26b0a8 a2=20000 a3=0 items=0 ppid=2385 pid=2632 auid=4294967295 uid=10080 gid=10080 euid=10080 suid=10080 fsuid=10080 egid=10080 sgid=10080 fsgid=10080 tty=(none) ses=4294967295 comm="power_metrics_r" exe="/system/bin/app_process32" subj=u:r:untrusted_app:s0:c512,c768 key=(null)
2018-10-27 12:57:59.522 12353-12353/? E/libpersona: Couldn't open the File - /data/system/users/0/personalist.xml - No such file or directory
2018-10-27 12:57:59.522 12353-12353/? E/libpersona: Couldn'
t open the File - /data/system/users/0/personalist.xml - No such file or directory
2018-10-27 12:58:05.926 12441-12441/br.com.drsolutions.prolissatelainicial E/AndroidRuntime: FATAL EXCEPTION: main
    Process: br.com.drsolutions.prolissatelainicial, PID: 12441
    java.lang.OutOfMemoryError: Failed to allocate a 12582924 byte allocation with 5493600 free bytes and 5MB until OOM
        at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
        at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
        at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:700)
        at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:535)
        at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1179)
        at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:770)
        at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:621)
        at android.content.res.Resources.getDrawable(Resources.java:1642)
        at android.content.Context.getDrawable(Context.java:525)
        at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:358)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:198)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:186)
        at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:100)
        at android.support.v7.widget.AppCompatImageHelper.setImageResource(AppCompatImageHelper.java:85)
        at android.support.v7.widget.AppCompatImageView.setImageResource(AppCompatImageView.java:93)
        at br.com.drsolutions.prolissatelainicial.adapter.ItemHomeAdapter.onBindViewHolder(ItemHomeAdapter.java:49)
        at br.com.drsolutions.prolissatelainicial.adapter.ItemHomeAdapter.onBindViewHolder(ItemHomeAdapter.java:26)
        at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6673)
        at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6714)
        at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5647)
        at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5913)
        at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5752)
        at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5748)
        at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2232)
        at android.support.v7.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:556)
        at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1519)
        at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:614)
        at android.support.v7.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:170)
        at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3812)
        at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3225)
        at android.view.View.measure(View.java:21125)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6461)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
        at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
        at android.view.View.measure(View.java:21125)
        at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:2150)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at android.widget.ScrollView.onMeasure(ScrollView.java:539)
        at android.view.View.measure(View.java:21125)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6461)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:141)
        at android.view.View.measure(View.java:21125)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6461)
        at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:400)
        at android.view.View.measure(View.java:21125)
2018-10-27 12:58:36.905 2846-3652/? E/SdpServiceKeeper: System app. Skip license activation
2018-10-27 12:58:36.907 2846-10603/? E/SdpServiceKeeper: System app. Skip license activation
2018-10-27 13:00:33.831 13510-13510/? E/libpersona: Couldn't open the File - /data/system/users/0/personalist.xml - No such file or directory
2018-10-27 13:00:33.832 13510-13510/? E/libpersona: Couldn'
t open the File - /data/system/users/0/personalist.xml - No such file or directory
2018-10-27 13:00:39.295 13659-13659/br.com.drsolutions.prolissatelainicial E/AndroidRuntime: FATAL EXCEPTION: main
    Process: br.com.drsolutions.prolissatelainicial, PID: 13659
    java.lang.OutOfMemoryError: Failed to allocate a 12582924 byte allocation with 10637488 free bytes and 10MB until OOM
        at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
        at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
        at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:700)
        at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:535)
        at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1179)
        at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:770)
        at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:621)
        at android.content.res.Resources.getDrawable(Resources.java:1642)
        at android.content.Context.getDrawable(Context.java:525)
        at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:358)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:198)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:186)
        at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:100)
        at android.support.v7.widget.AppCompatImageHelper.setImageResource(AppCompatImageHelper.java:85)
        at android.support.v7.widget.AppCompatImageView.setImageResource(AppCompatImageView.java:93)
        at br.com.drsolutions.prolissatelainicial.adapter.ItemHomeAdapter.onBindViewHolder(ItemHomeAdapter.java:49)
        at br.com.drsolutions.prolissatelainicial.adapter.ItemHomeAdapter.onBindViewHolder(ItemHomeAdapter.java:26)
        at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6673)
        at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6714)
        at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5647)
        at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5913)
        at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5752)
        at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5748)
        at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2232)
        at android.support.v7.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:556)
        at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1519)
        at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:614)
        at android.support.v7.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:170)
        at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3812)
        at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3225)
        at android.view.View.measure(View.java:21125)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6461)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
        at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
        at android.view.View.measure(View.java:21125)
        at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:2150)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at android.widget.ScrollView.onMeasure(ScrollView.java:539)
        at android.view.View.measure(View.java:21125)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6461)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:141)
        at android.view.View.measure(View.java:21125)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6461)
        at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:400)
        at android.view.View.measure(View.java:21125)
2018-10-27 13:00:39.357 13636-13985/? E/GOS:SeDex: failed to getSystemService()
2018-10-27 13:01:05.426 2846-10609/? E/SdpServiceKeeper: System app. Skip license activation
2018-10-27 13:01:05.429 2846-2866/? E/SdpServiceKeeper: System app. Skip license activation
2018-10-27 13:01:31.569 14387-14387/? E/libpersona: Couldn't open the File - /data/system/users/0/personalist.xml - No such file or directory
2018-10-27 13:01:31.570 14387-14387/? E/libpersona: Couldn'
t open the File - /data/system/users/0/personalist.xml - No such file or directory
2018-10-27 13:01:37.899 14539-14539/br.com.drsolutions.prolissatelainicial E/AndroidRuntime: FATAL EXCEPTION: main
    Process: br.com.drsolutions.prolissatelainicial, PID: 14539
    java.lang.OutOfMemoryError: Failed to allocate a 12582924 byte allocation with 5498928 free bytes and 5MB until OOM
        at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
        at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
        at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:700)
        at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:535)
        at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1179)
        at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:770)
        at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:621)
        at android.content.res.Resources.getDrawable(Resources.java:1642)
        at android.content.Context.getDrawable(Context.java:525)
        at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:358)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:198)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:186)
        at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:100)
        at android.support.v7.widget.AppCompatImageHelper.setImageResource(AppCompatImageHelper.java:85)
        at android.support.v7.widget.AppCompatImageView.setImageResource(AppCompatImageView.java:93)
        at br.com.drsolutions.prolissatelainicial.adapter.ItemHomeAdapter.onBindViewHolder(ItemHomeAdapter.java:49)
        at br.com.drsolutions.prolissatelainicial.adapter.ItemHomeAdapter.onBindViewHolder(ItemHomeAdapter.java:26)
        at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6673)
        at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6714)
        at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5647)
        at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5913)
        at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5752)
        at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5748)
        at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2232)
        at android.support.v7.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:556)
        at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1519)
        at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:614)
        at android.support.v7.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:170)
        at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3812)
        at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3225)
        at android.view.View.measure(View.java:21125)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6461)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
        at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
        at android.view.View.measure(View.java:21125)
        at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:2150)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at android.widget.ScrollView.onMeasure(ScrollView.java:539)
        at android.view.View.measure(View.java:21125)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6461)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:141)
        at android.view.View.measure(View.java:21125)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6461)
        at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:400)
        at android.view.View.measure(View.java:21125)
2018-10-27 13:02:14.985 2846-2867/? E/SdpServiceKeeper: System app. Skip license activation
2018-10-27 13:02:14.987 2846-10605/? E/SdpServiceKeeper: System app. Skip license activation
2018-10-27 13:04:20.178 2390-2390/? E/audit: type=1300 audit(1540652660.161:1939): arch=40000028 syscall=322 per=8 success=no exit=-13 a0=ffffff9c a1=ef26b0a8 a2=20000 a3=0 items=0 ppid=2385 pid=2632 auid=4294967295 uid=10080 gid=10080 euid=10080 suid=10080 fsuid=10080 egid=10080 sgid=10080 fsgid=10080 tty=(none) ses=4294967295 comm="power_metrics_r" exe="/system/bin/app_process32" subj=u:r:untrusted_app:s0:c512,c768 key=(null)


Segue o código fonte ItemHomeAdapter.java:
package br.com.drsolutions.prolissatelainicial.adapter;

import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.StrikethroughSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;
import java.text.DecimalFormat;

import br.com.drsolutions.prolissatelainicial.R;
import br.com.drsolutions.prolissatelainicial.model.ItemHome;

/**
 * Adapter (adaptador) referente aos itens da home do sistema.
 *
 * @author  Diego Mendes Rodrigues
 * @version 1.0
 */

public class ItemHomeAdapter extends RecyclerView.Adapter<ItemHomeAdapter.MyViewHolder> {

    private List<ItemHome> itens;

    public ItemHomeAdapter(List<ItemHome> itens) {
        this.itens = itens;
    }

    @NonNull
    @Override
    public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View item = LayoutInflater.from(parent.getContext())
                .inflate(R.layout.item_home, parent, false);

        return new MyViewHolder(item);
    }

    @Override
    public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
        ItemHome item = this.itens.get(position);

        DecimalFormat df = new DecimalFormat("0.00");

        holder.imgProduto.setImageResource(item.getImagem());
        holder.textTitulo.setText(item.getTitulo());

        Integer desconto = item.getDesconto();
        String textoValorDesconto = desconto.toString() + "%";
        holder.textDesconto.setText(textoValorDesconto);

        Double valorTotal = item.getValorTotal();
        String txtValorTotal = "R$ " + df.format(valorTotal);

        SpannableString stringValorTotal = new SpannableString(txtValorTotal);
        stringValorTotal.setSpan(new StrikethroughSpan(), 0, stringValorTotal.length(),
                Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

        holder.textValorTotal.setText(stringValorTotal);

        Double valorComDesconto = item.getValorComDesconto();
        String txtValorComDesconto = df.format(valorComDesconto);
        holder.textValorComDesconto.setText("R$ " + txtValorComDesconto);
    }

    @Override
    public int getItemCount() {
        return itens.size();
    }

    public class MyViewHolder extends RecyclerView.ViewHolder {
        private ImageView imgProduto;
        private TextView textTitulo;
        private TextView textDesconto;
        private TextView textValorTotal;
        private TextView textValorComDesconto;

        public MyViewHolder(View itemView) {
            super(itemView);

            this.imgProduto = itemView.findViewById(R.id.imgProduto);
            this.textTitulo = itemView.findViewById(R.id.textTitulo);
            this.textDesconto = itemView.findViewById(R.id.textDesconto);
            this.textValorTotal = itemView.findViewById(R.id.textValorTotal);
            this.textValorComDesconto = itemView.findViewById(R.id.textValorComDesconto);
        }
    }
}


Como devo proceder?

Obrigado,
Diego M. Rodrigues

_________________
Atenciosamente,
Diego M. Rodrigues


27 Out 2018, 14:07
Perfil WWW
Google employee
Google employee

Data de registro: 01 Jul 2013, 13:45
Mensagens: 2736
Localização: Rio de Janeiro
Mensagem Re: Problema ao executar app no celular
OutOfMemoryError. Vê o tamanho das imagens que você tá usando, se for isso mesmo o erro é porque elas são grandes demais.

_________________
Quando seu problema for resolvido, clique na opção Editar no lado superior direito da sua primeira mensagem e coloque [Resolvido] no título.
Se resolveu o problema sozinho, não esqueça de postar a solução, ela ajuda usuários em buscas no fórum.
Use os marcadores java e xml quando for postar algum código.

Aprenda Java com esta apostila.


31 Out 2018, 14:36
Perfil WWW
What is Android?
What is Android?

Data de registro: 03 Fev 2020, 13:22
Mensagens: 1
Mensagem Re: Problema ao executar app no celular
Permissões?
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


03 Fev 2020, 13:28
Perfil
Mostrar mensagens anteriores:  Organizar por  
Responder Tópico   [ 3 Mensagens ] 

Quem está online

Usuários vendo este fórum: adilson.afl, alexandre, alylson, amarildolacerdas, Andreid, andreleitao, andreluiz, Andrey, andrigo, AT-AT, Avelino Mateus Neto, avsouza, axellsan, billsombrio, BloggerCaOS, bravus, brazucx, Bruto_JPO, BTalhadas, C-3PO, car.demarco, Chewbacca, Clauber, cyzko, darllan.marinho, DAVINCE, Demerval, DITÃO, dkclan, dramos, dreyer, Eduardo - Brasil, eduardo.ali, elisa, euguns, Everton Moreira, fabric01, fabrizior, felipecomp19, ffabiano, flaviolemos, Francisco_Geraldo, Gabriel, gedoor, Guilherme, guilhermepilotti, guitarro17, gustavo, gutem25, guto.pro, gutodias, ijsilvestre, jackdaniel, jacksaum, Jaison, jhhm_2008, jlucasps, Joessi2007, jorgecardoso, jrchuteboxe, kecyobarros, kennedyximenes, Ki-Adi-Mundi, klyff, Kureiton, kusanaguy, laurj, leandroviana, Lincoln, lucianno, lucianoalves, Lucious, luizcyber, Luke Skywalker, Lúcio Zanette, malucouto, mapis, Marcelo Lima, marciosoliveira, Marco Magoo, marcosandreao, marcow, marianatallas, Marlus Dias Silva, martins, Matheus562, mauriciobreide, mauriciomag, Mayara Trevisol, Mig, mvoto, navegador, nirvana, Odigooogle™, onaiggac, onedroid, Orivalde, osternack, Patrick, paulabr, piagg, PicsearchDroid, pyrobit, Rafael, ramonsa, Ranieri, rdchaves, rfrafael, ricardo, ricardzanella, rmendes, Roberto, rodrigo_corinthians, rogerio.alcantara, romuloff, ronanPlus, rtodao, sandro, schiroky, sobrinho, srsilveira, talves, Tangerina, thiagoalgo, tiasousa, Toks, tonholis, tonylock, viniciusllima, woyzeck e 39 visitantes


Você não pode criar novos tópicos neste fórum
Você não pode responder tópicos neste fórum
Você não pode editar suas mensagens neste fórum
Você não pode excluir suas mensagens neste fórum
Você não pode enviar anexos neste fórum

Procurar por:
cron

© 2007 - 2016 Portal Android - Comunidade de Desenvolvedores Android

Estamos no Linkedin    Siga-nos no twitter


Powered by phpBB - Hospedado por Bemobi