我正在尝试测试正在使用的Android应用程序,可以在模拟器上看到该应用程序,但是每当尝试在手机上安装该应用程序时,都会出现错误。

我已经尝试过其他类似文章中列出的所有方法,但是解决方案似乎不适用于我的情况。

我的大部分情况都告诉我问题是活动名称重复,如错误:活动类{** com.example.thejourney / ** com.example.thejourney.WelcomeActivity}不存在。而不是com.example.thejourney.WelcomeActivity。如果是这样,我已经检查了它的来源。

欢迎活动

public class WelcomeActivity extends Activity {
    public static int SPLASH_TIME_OUT = 5000;
    LinearLayout l1,l2;
    ImageView logo;
    Animation uptodown,downtoup;
    @Override
     protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_welcome);
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            Intent mainIntent = new Intent(WelcomeActivity.this, MainActivity.class);
            startActivity(mainIntent);
            finish();
        }
    }, SPLASH_TIME_OUT);

    logo = (ImageView) findViewById(R.id.logo);
    l1 = (LinearLayout) findViewById(R.id.l1);
    l2 = (LinearLayout) findViewById(R.id.l2);
    uptodown = AnimationUtils.loadAnimation(this,R.anim.uptodown);
    downtoup = AnimationUtils.loadAnimation(this,R.anim.downtoup);
    l1.setAnimation(uptodown);
    l2.setAnimation(downtoup);
}}


表现

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.thejourney">

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

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

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".ProfileActivity"
        android:parentActivityName=".MainActivity" />
    <activity
        android:name=".AboutActivity"
        android:parentActivityName=".MainActivity" />
    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main"
        android:theme="@style/AppTheme.NoActionBar" />

    <meta-data
        android:name="preloaded_fonts"
        android:resource="@array/preloaded_fonts" />
</application>

</manifest>

最佳答案

您的设备可能无法运行,因为可能未启用开发人员模式和USB调试。尝试遵循https://developer.android.com/studio/run/device#setting-up中的步骤。

07-24 09:16