Android发布Genymotion但不在设备中

时间:2014-10-02 09:20:44

标签: android gradle android-studio android-manifest genymotion

当我想在装有AndroidStudio(AS)的设备中启动我的应用程序时,我遇到了麻烦。如果我在Genymotion中启动它可以正常工作,但是当我在我的设备中启动时,AS安装它但应用程序没有启动。

我的AndroidManifest.xml

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/CustomActionBarTheme" >

        <!-- Login Activity -->
        <activity
            android:name=".LoginActivity"
            android:label="Login Account" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        <activity
            android:name=".CenterTvSelection"
            android:label="@string/title_activity_center_tv_selection" >
        </activity>
    </application>

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

</manifest>

我的朋友。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion '20.0.0'
    defaultConfig {
        applicationId "com.twentyfit.twentyfitpublicidadtv"
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services:5.2.08'
    compile 'com.android.support:appcompat-v7:20.+'
    compile 'com.android.support:support-v4:20.+'
}

LOG:

Launching application: com.twentyfit.twentyfitpublicidadtv/com.twentyfit.twentyfitpublicidadtv.activities.LoginActivity.
DEVICE SHELL COMMAND: am start -n "com.twentyfit.twentyfitpublicidadtv/com.twentyfit.twentyfitpublicidadtv.activities.LoginActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.twentyfit.twentyfitpublicidadtv/.activities.LoginActivity }
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.twentyfit.twentyfitpublicidadtv/.activities.LoginActivity } from null (pid=11358, uid=2000) not exported from uid 10048
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1783)
at com.android.commands.am.Am.runStart(Am.java:463)
at com.android.commands.am.Am.run(Am.java:108)
at com.android.commands.am.Am.main(Am.java:81)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:268)
at dalvik.system.NativeStart.main(Native Method)
你可以帮帮我吗? THX

1 个答案:

答案 0 :(得分:0)

检查您的清单文件,第一个<activity> 标签未正确关闭。 intent-filter应该在activity标记内,在你的情况下不是。

更准确地说是这样:

<activity
        android:name=".LoginActivity"
        android:label="Login Account">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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