应用程序未在Marshmallow中开放

时间:2016-09-14 13:15:02

标签: android android-layout android-6.0-marshmallow

以前我的应用程序在Marshmallow崩溃。我在我的应用程序项目中设置了ACRA库,以便我可以解决崩溃问题。但是在添加之后,仍然没有在Marshmallow中打开应用程序。

AppDelegate.java

@ReportsCrashes(formUri = "http://demo.ivdisplays.net/meratiffin/report.php")

public class AppDelegate extends Application {

    public int isloggedin;
    public String name;
    public String first_name;
    public String landmark;
    public String deliveryName;
    public String deliveryEmail;
    public String deliveryMobile;
    public boolean isFirstTime;
    public boolean isFirstTime1;
    public String menu_id;

    public String last_name;
    public String city;
    public String state;
    public String zip;
    public String country;
    public String password;
    public String email;
    public String uid;
    public String mobile;
    public String address;
    public String userkey;

    public String image;
    public String identity_proof;
    public List<Menu_Item> cart=new ArrayList<Menu_Item>();
    public List<Menu> listDataHeader=new ArrayList<Menu>();;
    public HashMap<String, List<Menu_Item>> listDataChild =new HashMap<String, List<Menu_Item>>();
    public String order_id;
    public String total_amount;
    public double tax_vat;
    public String no_Of_Address;
    public double tax_amount;
    public String voucherCode="";
    public String CouponCode="";
    public boolean isRated;
    public String rest_id;
    public String rest_title;
    public double discount=0;
    public boolean showRestaurant;
    public TextToSpeech TTS;
    public int isFromSecurity = 0;

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        // The following line triggers the initialization of ACRA
        ACRA.init(this);
    }

    @Override
    public void onLowMemory() {
        super.onLowMemory();
        ClearCache.clearApplicationData(getApplicationContext());
    }

    public void Speak(String msg) {
        TTS.speak(msg, TextToSpeech.QUEUE_FLUSH, null);
    }

    public void setInMemory() {

        SharedPreferences shared = PreferenceManager
                .getDefaultSharedPreferences(getApplicationContext());

        SharedPreferences.Editor editor = shared.edit();
        editor.putString("name", this.name);
        editor.putString("first_name", this.first_name);
        editor.putString("last_name", this.last_name);
        editor.putString("city", this.city);
        editor.putString("state", this.state);
        editor.putString("order", this.order_id);
        editor.putString("zip", this.zip);
        editor.putBoolean("showRest", this.showRestaurant);
        editor.putString("totalAmount", this.total_amount);
        editor.putLong("discount", Double.doubleToRawLongBits(this.discount));
        editor.putLong("tax", Double.doubleToRawLongBits(this.tax_amount));
        editor.putLong("tax_vat", Double.doubleToRawLongBits(this.tax_vat));
        editor.putString("menu_id", this.menu_id);
        editor.putString("CouponCode", this.CouponCode);
        editor.putBoolean("isFirstTime", this.isFirstTime);
        editor.putBoolean("isFirstTime1", this.isFirstTime1);

        editor.putBoolean("rate", this.isRated);

        editor.putString("rest_Id", this.rest_id);
        editor.putString("rest_Title", this.rest_title);

        editor.putString("deliveryName", this.deliveryName);
        editor.putString("deliveryEmail", this.deliveryEmail);
        editor.putString("deliveryMobile", this.deliveryMobile);
        editor.putString("no_of_address", this.no_Of_Address);
        editor.putString("landmark", this.landmark);
        editor.putString("country", this.country);
        editor.putString("email", this.email);
        editor.putString("uid", this.uid);
        editor.putString("userkey", this.userkey);

        editor.putString("mobile", this.mobile);
        editor.putString("address", this.address);
        editor.putString("image", this.image);
        editor.putString("identity_proof", this.identity_proof);
        editor.putInt("islogged", this.isloggedin);

        editor.commit();
    }

    public void getFromMemory() {

        SharedPreferences shared = PreferenceManager
                .getDefaultSharedPreferences(getApplicationContext());
        this.name = shared.getString("name", "");
        this.email = shared.getString("email", "");
        this.uid = shared.getString("uid", "");
        this.first_name = shared.getString("first_name", "");
        this.last_name = shared.getString("last_name", "");
        this.city = shared.getString("city", "");
        this.state = shared.getString("state", "");
        this.zip = shared.getString("zip", "");
        this.order_id= shared.getString("order","");
        this.no_Of_Address=shared.getString("no_of_address", "");
        this.deliveryName=shared.getString("deliveryName", "");
        this.deliveryEmail=shared.getString("deliveryEmail","" );
        this.deliveryMobile=shared.getString("deliveryMobile", "");
        this.country = shared.getString("country", "");
        this.address = shared.getString("address", "");
        this.mobile = shared.getString("mobile", "");
        this.total_amount = shared.getString("totalAmount", "");
        this.menu_id = shared.getString("menu_id", "");
        this.discount =  Double.longBitsToDouble(shared.getLong("discount", 0));
        this.tax_amount =  Double.longBitsToDouble(shared.getLong("tax", 0));
        this.tax_vat =  Double.longBitsToDouble(shared.getLong("tax_vat", 0));

        this.userkey=shared.getString("userkey","");
        this.CouponCode=shared.getString("CouponCode", "");
        this.showRestaurant= shared.getBoolean("showRest",true);

        this.isFirstTime= shared.getBoolean("isFirstTime",true);
        this.isFirstTime1= shared.getBoolean("isFirstTime1",true);

        this.isRated= shared.getBoolean("rate",true);

        this.rest_id=shared.getString("rest_Id","");
        this.rest_title= shared.getString("rest_Title","");

        this.identity_proof = shared.getString("identity_proof", "");
        this.image = shared.getString("image", "");
        this.isloggedin = shared.getInt("islogged", 0);
        Log.e("user ID", this.uid);
    }

    public void flusFromMemory() {

        SharedPreferences shared = PreferenceManager
                .getDefaultSharedPreferences(getApplicationContext());
        SharedPreferences.Editor editor = shared.edit();
        editor.putString("name", "");
        editor.putString("image", "");
        editor.putString("email", "");
        editor.putString("uid", "");
        editor.putString("userkey", "");
        editor.putString("dob", "");
        editor.putString("deliveryName","");
        editor.putString("deliveryEmail","");
        editor.putString("deliveryMobile","");
        editor.putString("mobile", "");
        editor.putString("address", "");
        editor.putInt("islogged", 0);
        this.isloggedin = 0;

        editor.commit();
    }
}

的AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sony.faantush">

<uses-permission android:name="android.permission.INTERNET"/>

<application
    android:name=".AppDelegate"
    android:allowBackup="true"
    android:icon="@drawable/faantush_icon"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme.NoActionBar">
    <activity android:name=".SplashScreenActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="stateHidden|adjustPan"/>

    <activity android:name=".TopDetailsActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar"/>

    <activity android:name=".SingleTopDetails"
        android:label="@string/app_name"
        android:screenOrientation="portrait"/>

    <activity android:name=".slidingmenuactivity.InvoiceActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"/>

    <activity android:name=".slidingmenuactivity.DeliveryDetailsActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"/>

    <activity android:name=".screen.DemoCartActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"/>

    <activity android:name=".screen.DemoNotiActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"/>

    <activity android:name=".screen.DemoWishActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"/>

    <activity android:name=".screen.DemoOrderActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"/>

    <activity android:name=".screen.DemoShippingActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"/>

    <activity android:name=".slidingmenuactivity.AccountActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"/>

</application>

logcat的

  

09-14 18:42:15.479 20058-20058 / com.example.sony.faantush E / ACRA:ACRA捕获了com.example.sony.faantush的RuntimeException                                                                    java.lang.RuntimeException:无法启动活动   ComponentInfo {com.example.sony.faantush / com.example.sony.faantush.MainActivity}:   android.view.InflateException:二进制XML文件行#107:二进制XML   文件行#145:错误类膨胀                                                                        在   android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2464)                                                                        在   android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2524)                                                                        在android.app.ActivityThread.access $ 900(ActivityThread.java:154)                                                                        在   android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1391)                                                                        在android.os.Handler.dispatchMessage(Handler.java:102)                                                                        在android.os.Looper.loop(Looper.java:234)                                                                        在android.app.ActivityThread.main(ActivityThread.java:5526)                                                                        at java.lang.reflect.Method.invoke(Native Method)                                                                        在   com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:726)                                                                        在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)                                                                     引起:android.view.InflateException:二进制XML文件行#107:   二进制XML文件行#145:错误类膨胀                                                                        在android.view.LayoutInflater.inflate(LayoutInflater.java:539)                                                                        在android.view.LayoutInflater.inflate(LayoutInflater.java:423)                                                                        在android.view.LayoutInflater.inflate(LayoutInflater.java:374)                                                                        在   com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:400)                                                                        在android.app.Activity.setContentView(Activity.java:2177)                                                                        在   com.example.sony.faantush.MainActivity.onCreate(MainActivity.java:87)                                                                        在android.app.Activity.performCreate(Activity.java:6285)                                                                        在   android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)                                                                        在   android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)                                                                        在   android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2524)                                                                        在android.app.ActivityThread.access $ 900(ActivityThread.java:154)                                                                        在   android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1391)                                                                        在android.os.Handler.dispatchMessage(Handler.java:102)                                                                        在android.os.Looper.loop(Looper.java:234)                                                                        在android.app.ActivityThread.main(ActivityThread.java:5526)

请帮我解决这个问题。非常感谢你。

activity_main.xml中

<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
tools:context="com.example.sony.faantush.MainActivity">

<ScrollView
    android:layout_width="wrap_content"
    android:layout_height="220dp">
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:background="#e3e2e3">

    <RelativeLayout
        android:id="@+id/rl_main1"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="@drawable/header_bar" >

        <LinearLayout
            android:id="@+id/ll_main01"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:gravity="center"
            android:orientation="vertical"
            android:onClick="onClickMenu" >

            <ImageView
                android:id="@+id/iv_slider"
                android:layout_width="25dp"
                android:layout_height="20dp"
                android:background="@drawable/menu" />
        </LinearLayout>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Version 1.2"
            android:textColor="#fff"
            android:textStyle="bold"
            android:layout_toRightOf="@id/ll_main01"
            android:layout_centerVertical="true"/>
        <LinearLayout
            android:id="@+id/ll_search"
            android:layout_width="110dp"
            android:layout_height="50dp"
            android:layout_alignParentRight="true"
            android:gravity="center"
            android:visibility="visible">
            <TextView
                android:id="@+id/tvNoti"
                android:layout_width="15dp"
                android:layout_height="15dp"
                android:background="@drawable/noti_bar"
                android:layout_marginLeft="20dp"/>
            <TextView
                android:id="@+id/tvCart"
                android:layout_width="15dp"
                android:layout_height="15dp"
                android:background="@drawable/cart_bar"
                android:layout_marginLeft="20dp"/>
        </LinearLayout>
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:layout_marginTop="5dp"
        android:layout_marginBottom="5dp"
        android:background="#fff">
        <EditText
            android:id="@+id/et_search"
            android:layout_width="match_parent"
            android:layout_height="20dp"
            android:hint="Search"
            android:background="@drawable/search_bar"
            android:paddingLeft="10dp"
            android:cursorVisible="false"
            android:layout_centerVertical="true"/>
        <ImageButton
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:background="@drawable/search_bar_icon"
            android:layout_alignParentRight="true"
            android:layout_marginRight="5dp"
            android:layout_centerVertical="true"/>
    </RelativeLayout>

    <!-- Image Slide Show -->
    <android.support.v4.view.ViewPager
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/pager"
        android:layout_width="wrap_content"
        android:layout_height="180dp"/>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="2dp"
        android:background="@drawable/background"/>
    <include
        layout="@layout/activity_demo_home_products" />
</LinearLayout>
</ScrollView>

<FrameLayout
    android:id="@+id/content_frame"
    android:layout_below="@+id/rl_main1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />
<ExpandableListView
    android:id="@+id/left_drawer"
    android:layout_width="280dp"
    android:layout_height="match_parent"
    android:layout_gravity="left"
    android:background="@drawable/slideinslideout_logo"
    android:groupIndicator="@null"
    android:choiceMode="singleChoice"
    android:scrollbars="none"
    android:divider="@null"
    android:dividerHeight="0dp"/>

activity_demo_home_products.xml

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="10dp"
android:layout_gravity="center">
<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="5dp">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="20dp"
        android:textStyle="bold"
        android:text="Our Popular Products"/>
    <Button
        android:layout_width="60dp"
        android:layout_height="20dp"
        android:text="View All"
        android:textColor="#fff"
        android:textSize="10dp"
        android:layout_marginRight="10dp"
        android:layout_alignParentRight="true"
        android:background="@drawable/view_all"/>
</RelativeLayout>
<HorizontalScrollView
    android:id="@+id/hsv"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:measureAllChildren="false"
    android:scrollbars="none"
    android:layout_marginTop="10dp">
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="120dp"
        android:orientation="horizontal"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:showDividers="middle"
        android:divider="@drawable/empty_tall_divider">

        <LinearLayout
            android:id="@+id/ll_dress1"
            android:layout_width="100dp"
            android:layout_height="110dp"
            android:orientation="vertical"
            android:background="#fff"
            android:gravity="center"
            android:layout_margin="7dp">
            <ImageButton
                android:id="@+id/clickTop"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:layout_weight="1"
                android:background="@drawable/discount_home1"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Green Top" />
        </LinearLayout>
        <LinearLayout
            android:id="@+id/ll_dress2"
            android:layout_width="100dp"
            android:layout_height="110dp"
            android:orientation="vertical"
            android:background="#fff"
            android:gravity="center"
            android:layout_margin="7dp">
            <ImageView
                android:layout_width="120dp"
                android:layout_height="120dp"
                android:layout_weight="1"
                android:background="@drawable/dh"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Red Top" />
        </LinearLayout>
        <LinearLayout
            android:id="@+id/ll_dress3"
            android:layout_width="100dp"
            android:layout_height="110dp"
            android:orientation="vertical"
            android:background="@drawable/prev_product_box"
            android:gravity="center"
            android:layout_margin="7dp">
            <ImageView
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:layout_weight="1"
                android:background="@drawable/sgda"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Jackets" />
        </LinearLayout>
        <LinearLayout
            android:id="@+id/ll_dress4"
            android:layout_width="100dp"
            android:layout_height="110dp"
            android:orientation="vertical"
            android:background="#fff"
            android:gravity="center"
            android:layout_margin="7dp">
            <ImageButton
                android:id="@+id/clickTop1"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:layout_weight="1"
                android:background="@drawable/offer_of_the_day1"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Jackets" />
        </LinearLayout>
        <LinearLayout
            android:id="@+id/ll_dress5"
            android:layout_width="100dp"
            android:layout_height="110dp"
            android:orientation="vertical"
            android:background="#fff"
            android:gravity="center"
            android:layout_margin="7dp">
            <ImageView
                android:layout_width="120dp"
                android:layout_height="120dp"
                android:layout_weight="1"
                android:background="@drawable/offer_of_the_day2"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Shirt" />
        </LinearLayout>
        <LinearLayout
            android:id="@+id/ll_dress6"
            android:layout_width="100dp"
            android:layout_height="110dp"
            android:orientation="vertical"
            android:background="@drawable/prev_product_box"
            android:gravity="center"
            android:layout_margin="7dp">
            <ImageView
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:layout_weight="1"
                android:background="@drawable/offer_of_the_day3"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Jackets" />
        </LinearLayout>
    </LinearLayout>
</HorizontalScrollView>

1 个答案:

答案 0 :(得分:0)

layout_width layout_height 设置为包含标记

<include
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    layout="@layout/activity_demo_home_products" />