2017-08-25 124 views
-1

因此,我正在对项目中的包名进行一些重构,现在我无法再安装我的应用了。大约在我更新到最新版本的android studio的同时。我认为,可能是问题,因为我觉得我没升级前的重构,我只是不记得了100%安装失败,显示消息“INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME”

这里是我的清单

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

<application 
    android:allowBackup="true" 
    android:icon="@mipmap/dodging_fire_icon" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name=".gamemain.GameMainActivity" 
     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> 

这是我有我的包组织

http://prntscr.com/gcrw99

这是完全错误消息当我尝试运行我的应用程序

Installation failed with message Failed to finalize session : INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME: Invalid manifest package: must have at least one '.' separator. 
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing. 

WARNING: Uninstalling will remove the application data! 

Do you want to uninstall the existing application? 

即使我接受删除现有的应用程序,它仍然给我一个错误,并没有安装我的应用程序,更不用说运行它了。

+0

Manifest软件包名称不是APK中的结果。查看build.gradle文件中的'applicationId'。 – laalto

+0

扩展为答案。 – laalto

回答

2

源文件清单文件中的package名称实际上并不是最终安装的APK中的名称。在清单合并过程中,最终的软件包名称基于您应用的build.gradle文件中的applicationId值。

正如错误消息所述,您至少需要包名称中的一个.

INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME的其他原因可以在PackageParser#validateName() source中找到。