简体   繁体   English

Android Studio构建APK

[英]Android Studio build apk

I wrote an app using Android Studio. 我使用Android Studio编写了一个应用程序。 How can I generate an APK file and install it on my Device. 如何生成APK文件并将其安装在我的设备上。 I tried with "make project" and "generate signed APK". 我尝试使用“制作项目”和“生成签名的APK”。 Nothing works. 什么都没有。 With "generate signed APK" I was able to install the app but I cannot run it. 使用“生成已签名的APK”,我可以安装该应用程序,但无法运行它。 The app does not appear in my app list. 该应用程序未出现在我的应用程序列表中。 Can someone help, pls? 有人可以帮忙吗?

Inside your Project folder, go to \\app\\build\\outputs\\apk and then copy the app-debug.apk to your device. 在您的Project文件夹中,转到\\ app \\ build \\ outputs \\ apk,然后将app-debug.apk复制到您的设备。 Then, open the .apk file in your device and install it. 然后,在设备中打开.apk文件并安装。 Another method, if you have developer options enabled on your phone, enabled USB debugging and correctly installed driver on your computer, then Android Studio will automatically recognize your device and you can directly install your app from within Android Studio by hitting the Run button like you would in an emulator. 另一种方法是,如果您在手机上启用了开发人员选项,已启用USB调试并在计算机上正确安装了驱动程序,则Android Studio将自动识别您的设备,并且您可以通过点击“运行”按钮直接在Android Studio中安装应用程序将在模拟器中。

First , you do not have to install the APK in order to test the app. 首先 ,您无需安装APK即可测试该应用。 Just Click in Android Studio -> Run -> Run '< your app name>'. 只需在Android Studio中单击->运行->运行'<您的应用名称>'。

Second : could it be that the launcher intent to your manifest is missing? 第二 :可能是您的清单缺少启动器吗?

 <application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="landscape">

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

If your app is running on the emulator, what you can do is that you enable developer options of your phone and then connect your phone with the system. 如果您的应用程序正在模拟器上运行,则可以执行的操作是启用手机的开发人员选项,然后将手机与系统连接。 After that when you will click on 'RUN'the dialog box will show that your phone is connected and in that the application can be installed. 之后,当您单击“运行”时,对话框将显示您的电话已连接并且可以安装该应用程序。

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

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