"Unfortunately, My Order has stopped" (My Order is the name of the app). How to resolve?

Asked

Viewed 124 times

0

Event Log

11/05/2018
13:06   Executing tasks: [:app:assembleDebug]

13:07   Gradle build finished in 6s 267ms

Logcat

05-11 16:07:12.601 6407-6407/com.example.aless.meupedido E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.aless.meupedido, PID: 6407
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.aless.meupedido/com.example.aless.meupedido.MainActivity}: android.view.InflateException: Binary XML file line #38: Binary XML file line #38: Error inflating class info.hoang8f.widget.FButton
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
        at android.app.ActivityThread.-wrap12(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6077)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
     Caused by: android.view.InflateException: Binary XML file line #38: Binary XML file line #38: Error inflating class info.hoang8f.widget.FButton
     Caused by: android.view.InflateException: Binary XML file line #38: Error inflating class info.hoang8f.widget.FButton
     Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
        at android.view.LayoutInflater.createView(LayoutInflater.java:645)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
        at com.example.aless.meupedido.MainActivity.onCreate(MainActivity.java:19)
        at android.app.Activity.performCreate(Activity.java:6662)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
        at android.app.ActivityThread.-wrap12(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6077)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
     Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 1 to color: type=0x5
        at android.content.res.TypedArray.getColor(TypedArray.java:463)
        at info.hoang8f.widget.FButton.parseAttrs(FButton.java:116)
        at info.hoang8f.widget.FButton.<init>(FButton.java:52)
        at java.lang.reflect.Constructor.newInstance0(Native Method) 
        at java.lang.reflect.Constructor.newInstance(Constructor.java:430) 
        at android.view.LayoutInflater.createView(LayoutInflater.java:645) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:858) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:861) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:518) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:426) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:377) 
        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
        at com.example.aless.meupedido.MainActivity.onCreate(MainActivity.java:19) 
        at android.app.Activity.performCreate(Activity.java:6662) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707) 
        at android.app.ActivityThread.-wrap12(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:154) 
        at android.app.ActivityThread.main(ActivityThread.java:6077) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756) 
05-11 16:07:42.822 6407-6431/com.example.aless.meupedido E/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE
05-11 16:08:43.080 6407-6431/com.example.aless.meupedido E/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE
05-11 16:10:13.224 6407-6431/com.example.aless.meupedido E/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE

Mainactivity.java

package com.example.aless.meupedido;

import android.content.Intent;
import android.graphics.Typeface;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    Button btnSignIn, btnSignUp;
    TextView txtSlogan;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        btnSignIn = (Button)findViewById(R.id.btnSignIn);
        btnSignUp = (Button)findViewById(R.id.btnSignUp);

        txtSlogan = (TextView)findViewById(R.id.txtSlogan);
        Typeface face = Typeface.createFromAsset(getAssets(),"fonts/NABILA.TTF");
        txtSlogan.setTypeface(face);

        btnSignIn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });

        btnSignUp.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent signUp = new Intent(MainActivity.this, SignUp.class);
                startActivity(signUp);
            }
        });

        btnSignIn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent signIn = new Intent(MainActivity.this, SignIn.class);
                startActivity(signIn);
            }
        });
    }
}

activity_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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/resize_img"
    tools:context=".MainActivity">

    <LinearLayout
        android:orientation="vertical"
        android:layout_centerInParent="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <ImageView
            android:src="@drawable/logo_easy"
            android:layout_width="200dp"
            android:layout_height="200dp" />

        <TextView
            android:gravity="center"
            android:id="@+id/txtSlogan"
            android:text="@string/slogan"
            android:textColor="@android:color/white"
            android:layout_width="200dp"
            android:layout_height="wrap_content" />

    </LinearLayout>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_alignParentBottom="true"
        android:weightSum="2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <info.hoang8f.widget.FButton
            android:id="@+id/btnSignUp"
            android:text="Cadastrar"
            android:textColor="@android:color/white"
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            app:buttonColor="@color/btnSignUp"
            app:shadowColor="@android:color/black"
            app:shadowEnabled="true"
            app:shadowHeight="5dp"
            app:cornerRadius="4dp"
            />

        <info.hoang8f.widget.FButton
            android:id="@+id/btnSignIn"
            android:text="Entrar"
            android:textColor="@android:color/white"
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            app:buttonColor="@color/btnSignActive"
            app:shadowColor="@android:color/black"
            app:shadowEnabled="true"
            app:shadowHeight="5dp"
            app:cornerRadius="4dp"
            />

    </LinearLayout>

</RelativeLayout>
  • at com.example.aless.meupedido.MainActivity.onCreate(MainActivity.java:19) ?

  • This line tries to inflate an XML file, post the XML too, please, and point to line 18 of it.

  • 1

    Excuse me, line 38. The cause is here: Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 1 to color: type=0x5

  • @Piovezan thank you, but how do I fix it?

  • @Álessonmaia Poste seu activity_main.xml.

  • I did the 2 steps of github, but they didn’t work for me

  • Deleted trivial comment

  • I saw a guy talking who went through this problem with this Fbutton there, and a user talked to use his lib as a dependency that solved the problem: https://github.com/jd-alexander/android-flat-button. The thread was this: https://github.com/hoang8f/android-flat-button/issues/41 see if this helps you :)

Show 4 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.