简体   繁体   English

从PC安装后无法在移动设备上打开APK文件

[英]Can't open APK file on mobile device after installing from PC

I've made an Android application using Eclipse. 我使用Eclipse创建了一个Android应用程序。 It has no errors, good to go, but I wanted to test it on my own phone first. 它没有错误,很好,但我想先在自己的手机上测试它。 I copied the APK file to my Samsung Galaxy S6 using an USB cable. 我使用USB线将APK文件复制到我的Samsung Galaxy S6。 Unplugged it, made sure the file version is not higher or later than my android version on my phone. 拔掉它,确保文件版本不高于或高于我手机上的Android版本。

Used an APK installer app, and it's installed. 使用了APK安装程序应用,并已安装。 It's at my files, and I can update it how many times I want. 它在我的文件中,我可以多次更新它。 After updating, or installing it gives 2 buttons in the button. 更新或安装后,按钮中有2个按钮。 "Ready" and "Open". “准备好”和“打开”。 "Ready" is the only one clickable, and leaves the page. “就绪”是唯一可点击的,并离开页面。 I can't open the apk-file. 我无法打开apk文件。 I've followed every tutorial but I just can't open it. 我已经按照每个教程,但我无法打开它。

This is my Manifest code: 这是我的清单代码:

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

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />

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

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".BezoekActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="com.example.rodekruis.BezoekActivity" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".AfspraakActivity"
            android:label="@string/title_activity_afspraak" >
        </activity>
        <activity
            android:name=".ContactActivity"
            android:label="@string/title_activity_contact" >
        </activity>
        <activity
            android:name=".MeningActivity"
            android:label="@string/title_activity_mening" >
        </activity>
        <activity
            android:name=".RouteActivity"
            android:label="@string/title_activity_route" >
        </activity>
        <activity
            android:name=".SpecialistenActivity"
            android:label="@string/title_activity_specialisten" >
        </activity>
        <activity
            android:name=".BWCActivity"
            android:label="@string/title_activity_bwc" >
        </activity>
        <activity
            android:name=".AgendaActivity"
            android:label="@string/title_activity_agenda" >
        </activity>
        <activity
            android:name=".InfoActivity"
            android:label="@string/title_activity_informatie" >
        </activity>
        <activity
            android:name=".VriendActivity"
            android:label="@string/title_activity_vriend" >
        </activity>
        <activity
            android:name=".FoldersActivity"
            android:label="@string/title_activity_folders" >
        </activity>
        <activity
            android:name=".NieuwsActivity"
            android:label="@string/title_activity_nieuws">
        </activity>
    </application>

</manifest>

Does anybody knows why this is, or how I can solve it? 有谁知道这是为什么,或者我如何解决它? If I need to add more things, feel free to ask. 如果我需要添加更多东西,请随时提问。 I'm struggling with this and really want it to work on my phone. 我正在努力解决这个问题,并希望它能在我的手机上运行。 Thanks in advance! 提前致谢!

Activate USB debugging. 激活USB调试。 It is easier. 这更容易。

Also: 也:

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

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />

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

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".BezoekActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.category.DEFAULT" />

                <category android:name="com.example.rodekruis.BEZOEKACTIVITY" />
            </intent-filter>
        </activity>
        <activity
            android:name=".AfspraakActivity"
            android:label="@string/title_activity_afspraak" >

        </activity>
        <activity
            android:name=".ContactActivity"
            android:label="@string/title_activity_contact" >
        </activity>
        <activity
            android:name=".MeningActivity"
            android:label="@string/title_activity_mening" >
        </activity>
        <activity
            android:name=".RouteActivity"
            android:label="@string/title_activity_route" >
        </activity>
        <activity
            android:name=".SpecialistenActivity"
            android:label="@string/title_activity_specialisten" >
        </activity>
        <activity
            android:name=".BWCActivity"
            android:label="@string/title_activity_bwc" >
        </activity>
        <activity
            android:name=".AgendaActivity"
            android:label="@string/title_activity_agenda" >
        </activity>
        <activity
            android:name=".InfoActivity"
            android:label="@string/title_activity_informatie" >
        </activity>
        <activity
            android:name=".VriendActivity"
            android:label="@string/title_activity_vriend" >
        </activity>
        <activity
            android:name=".FoldersActivity"
            android:label="@string/title_activity_folders" >
        </activity>
        <activity
            android:name=".NieuwsActivity"
            android:label="@string/title_activity_nieuws">
        </activity>
    </application>

</manifest>

You have to have a launcher defined. 你必须定义一个启动器。 The rest have to be defined as you originally defined the first activity with default and the package name. 其余部分必须定义为您最初使用默认值和包名称定义的第一个活动。 The main activity(the first to launch) has to be defined with MAIN and LAUNCHER 主要活动(第一个发射)必须用MAINLAUNCHER定义

EDIT: 编辑:

OK, I screwed up. 好吧,我搞砸了。 I updated it. 我更新了它。 Action cannot be the package name: 动作不能是包名:

<action android:name="android.intent.category.DEFAULT" />

<category android:name="com.example.rodekruis.BEZOEKACTIVITY" />

You did it the other way around which is why it didnt work. 你做了另一种方式,这就是为什么它没有工作。 You have to do the default and name for all the activities. 您必须为所有活动执行默认和名称。 The MainActivity was written correctly MainActivity已正确编写

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

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