应用程序未打开" MonMos已停止"

时间:2018-01-11 14:31:44

标签: java android

我的代码没有出现任何错误,我已经更改了依赖项,我还导入了必要的文件,但是,当我尝试在nexus 5虚拟智能手机上运行应用程序时,我一直收到此错误。< / p>

01/11 14:25:01: Launching app
$ adb install-multiple -r -t /Users/adnanahmed/MonMos/app/build/intermediates/split-apk/debug/dep/dependencies.apk /Users/adnanahmed/MonMos/app/build/intermediates/split-apk/debug/slices/slice_3.apk /Users/adnanahmed/MonMos/app/build/intermediates/split-apk/debug/slices/slice_2.apk /Users/adnanahmed/MonMos/app/build/intermediates/split-apk/debug/slices/slice_1.apk /Users/adnanahmed/MonMos/app/build/intermediates/split-apk/debug/slices/slice_0.apk /Users/adnanahmed/MonMos/app/build/intermediates/split-apk/debug/slices/slice_4.apk /Users/adnanahmed/MonMos/app/build/intermediates/split-apk/debug/slices/slice_6.apk /Users/adnanahmed/MonMos/app/build/intermediates/split-apk/debug/slices/slice_7.apk /Users/adnanahmed/MonMos/app/build/intermediates/split-apk/debug/slices/slice_5.apk /Users/adnanahmed/MonMos/app/build/intermediates/split-apk/debug/slices/slice_8.apk /Users/adnanahmed/MonMos/app/build/intermediates/split-apk/debug/slices/slice_9.apk /Users/adnanahmed/MonMos/app/build/outputs/apk/debug/app-debug.apk 
Split APKs installed
$ adb shell am start -n "app.monmos/app.monmos.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Connected to process 4941 on device emulator-5556
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
W/InstanceID/Rpc: Found 10011
D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
I/FA: App measurement is starting up, version: 10298
I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
V/FA: Collection enabled
V/FA: App package, google app id: app.monmos, 1:62957583411:android:a3878682ee3e6d75
I/FA: To enable faster debug mode event logging run:
        adb shell setprop debug.firebase.analytics.app app.monmos
D/FA: Debug-level message logging enabled
V/FA: Registered activity lifecycle callback
I/FirebaseInitProvider: FirebaseApp initialization successful
I/InstantRun: starting instant run server: is main process
V/FA: Using measurement service
V/FA: Connecting to remote service
V/FA: onActivityCreated
D/skia: --- SkAndroidCodec::NewFromStream returned null
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: app.monmos, PID: 4941
                  java.lang.RuntimeException: Unable to start activity ComponentInfo{app.monmos/app.monmos.MainActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class info.hoang8f.widget.FButton
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
                      at android.app.ActivityThread.-wrap11(Unknown Source:0)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
                      at android.os.Handler.dispatchMessage(Handler.java:106)
                      at android.os.Looper.loop(Looper.java:164)
                      at android.app.ActivityThread.main(ActivityThread.java:6494)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
                   Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class info.hoang8f.widget.FButton
                   Caused by: android.view.InflateException: Binary XML file line #0: 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:334)
                      at android.view.LayoutInflater.createView(LayoutInflater.java:647)
                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
                      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
                      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                      at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
                      at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
                      at app.monmos.MainActivity.onCreate(MainActivity.java:19)
                      at android.app.Activity.performCreate(Activity.java:6999)
                      at android.app.Activity.performCreate(Activity.java:6990)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
                      at android.app.ActivityThread.-wrap11(Unknown Source:0)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
                      at android.os.Handler.dispatchMessage(Handler.java:106)
                      at android.os.Looper.loop(Looper.java:164)
                      at android.app.ActivityThread.main(ActivityThread.java:6494)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
                   Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 1 to color: type=0x5
                      at android.content.res.TypedArray.getColor(TypedArray.java:473)
                      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:334) 
                      at android.view.LayoutInflater.createView(LayoutInflater.java:647) 
                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) 
                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) 
                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) 
                      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) 
                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:866) 
                      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) 
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                      at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
                      at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
                      at app.monmos.MainActivity.onCreate(MainActivity.java:19) 
                      at android.app.Activity.performCreate(Activity.java:6999) 
                      at android.app.Activity.performCreate(Activity.java:6990) 
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) 
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731) 
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
                      at android.app.ActivityThread.-wrap11(Unknown Source:0) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
                      at android.os.Handler.dispatchMessage(Handler.java:106) 
                      at android.os.Looper.loop(Looper.java:164) 
                      at android.app.ActivityThread.main(ActivityThread.java:6494) 
                      at java.lang.reflect.Method.invoke(Native Method) 
                      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
Application terminated.

这是控制台中出现的错误(上图),这是我的主要活动类。

package app.monmos;

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;
Button 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(),"fontss/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) {

        }
    });


}
}

布局

<?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/backgroundimage"
tools:context="app.monmos.MainActivity">

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

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


    <TextView
        android:gravity="center"
        android:id="@+id/txtSlogan"
        android:text="@string/slogan"
        android:textSize="30dp"
        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="Sign Up"
    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/btsSignUp"
    app:shadowColor="@android:color/black"
    app:shadowHeight="5dp"
    app:shadowEnabled="true"
    app:cornerRadius="4dp"
    />



    <info.hoang8f.widget.FButton
        android:id="@+id/btnSignIn"
        android:text="Sign In"
        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/btsSignActive"
        app:shadowColor="@android:color/black"
        app:shadowHeight="5dp"
        app:shadowEnabled="true"
        app:cornerRadius="4dp"
        />


</LinearLayout>

有人可以告诉我该怎么办? 我一直在寻找过去4个小时。

1 个答案:

答案 0 :(得分:0)

例外:

java.lang.RuntimeException: Unable to start activity ComponentInfo{app.monmos/app.monmos.MainActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class info.hoang8f.widget.FButton

似乎是由以下原因造成的:

Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 1 to color: type=0x5

有一个未解决的问题:https://github.com/hoang8f/android-flat-button/issues/41

他们建议在FButton.java和attrs.xml中将属性FButton_buttonColor更改为FButton_fButtonColor

请参阅此提交以获取更多详细信息: https://github.com/jd-alexander/android-flat-button/commit/d699cfb239afa6f8928ef93f9145fa44194f7b85