简体   繁体   English

不启动 mainactivity

[英]does not start mainactivity

The assembly occurs, but at startup it gives an error.组装发生,但在启动时会出错。 What could be the problem?可能是什么问题呢? Help me.帮我。 Both on the emulator and on the real device.无论是在模拟器上还是在真实设备上。

The assembly occurs, but at startup it gives an error.组装发生,但在启动时会出错。 What could be the problem?可能是什么问题呢? Help me.帮我。 Both on the emulator and on the real device.无论是在模拟器上还是在真实设备上。 Here is the manifest这是清单

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="my.packpage">

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

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".DownloadActivity"
        android:theme="@style/AppTheme"
        android:excludeFromRecents="true"
        android:taskAffinity="">

        <intent-filter>
            <action android:name="android.intent.action.SEND" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="text/plain" />
        </intent-filter>

    </activity>

    <receiver

android:name=".DownloadFinishedReceiver"
        android:exported="true"
        android:process=".dlFinished">
        <intent-filter>
            <action 
android:name="android.intent.action.DOWNLOAD_COMPLETE" />
        </intent-filter>
    </receiver>
</application>

</manifest>

Here is the Activity_Main.xml这是 Activity_Main.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 
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"
tools:context=".MainActivity">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="16dp"
    android:layout_marginLeft="16dp"
    android:text="@string/wel"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintHorizontal_bias="1.0"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="0.051" />

 </android.support.constraint.ConstraintLayout>

Here is the MainActivity.java这是 MainActivity.java

package my.packpage;


import android.os.Bundle;

import android.support.v7.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

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

providing the error message generated would be the first step in finding the answer.. you may need to edit the question提供生成的错误消息将是找到答案的第一步。您可能需要编辑问题

first debug the application to know where the real problem is.首先调试应用程序以了解真正的问题在哪里。 Then post that error here然后在此处发布该错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM