应用程序未在虚拟设备中运行执行完成Android Studio

问题描述 投票:0回答:1

按下“运行”按钮后,我的应用程序未在虚拟设备上运行,我收到消息 Execution finished。该项目是正确的 building 并且我在 logcat 中没有收到任何错误消息。

我已经删除了所有虚拟设备并创建了一个运行良好的新设备,因为我可以将其加载到设备管理器中。我还检查了Run configurations选项卡,似乎没问题。

这是我的 Android tree structure

这是我的清单和 gradle 文件

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

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.DeviworksApp"
        tools:targetApi="31">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:screenOrientation="sensorLandscape">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.2.2' apply false
    id ("com.google.devtools.ksp") version "1.9.0-1.0.12" apply false
}


plugins {
    id 'com.android.application'
    id 'com.google.devtools.ksp'
}

android {
    namespace 'com.deviworksapp'
    compileSdk 34

    defaultConfig {
        applicationId "com.deviworksapp"
        minSdk 21
        targetSdk 34
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    dataBinding{
        enabled=true
    }
    buildFeatures {
        viewBinding true
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.11.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

    def room_version = "2.6.1"

   implementation("androidx.room:room-runtime:$room_version")
   annotationProcessor("androidx.room:room-compiler:$room_version")
   // To use Kotlin annotation processing tool (kapt)
   ksp("androidx.room:room-compiler:$room_version")
   // optional - Kotlin Extensions and Coroutines support for Room
   implementation("androidx.room:room-ktx:$room_version")
   // optional - Test helpers
   testImplementation("androidx.room:room-testing:$room_version")
   // optional - Paging 3 Integration
   implementation("androidx.room:room-paging:$room_version")
}
android
1个回答
0
投票

有时会因为 Android Studio 缓存问题而发生。尝试使缓存无效并重新启动工作室。在下图中选择所有选项。

© www.soinside.com 2019 - 2024. All rights reserved.