首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Google-play-services和INSTALL_PARSE_FAILED_MANIFEST_MALFORMED

Google-play-services和INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
EN

Stack Overflow用户
提问于 2017-02-21 13:23:51
回答 2查看 142关注 0票数 0

我正在从Eclipse迁移到Android Studio。当我将Google-play-services集成到我的项目中时,我无法将APK安装到设备上,并出现以下错误:"INSTALL_PARSE_FAILED_MANIFEST_MALFORMED“。为什么eerrApparently Android Studio和这个库与我的遗留应用程序的包名有兼容性问题,包名以大写字母开头。当我将包名的第一个字母( Android Studio中的ApplicationId)更改为lower时,一切正常。请注意,我的基包名称都是小写的。问题出在ApplicationId上。

这个应用程序已经在商店上线几年了,我不想把它作为一个新的应用程序上传。

真的卡在这个问题上了--有变通的办法吗?

EN

回答 2

Stack Overflow用户

发布于 2017-02-21 15:10:12

请参考Naming Conventions

你不能再简单地使用大写的包名了。

票数 0
EN

Stack Overflow用户

发布于 2017-03-11 00:16:16

这对我很有效:

而不是将eclipse项目导入Android Studio,

(1)创建一个新的Android Studio项目,使用您已经放在Google Play Store上的包名,但全部使用小写。

(2)然后将所有文件复制到Android Studio项目中。

(3)更改build.gradle (模块应用程序)文件中的包ID,使用大写的原始包名称(见下文)和同步(这将在apk中创建具有大写字符的原始包名称,它将上载到谷歌Play商店并替换旧的包名称!

(4)将apk (包名大写)安装到我的测试手机上,它工作得很好。

代码语言:javascript
复制
apply plugin: 'com.android.application'
android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"
    defaultConfig {
        applicationId "DrWebsterApps.New.England.Patriots.Game"
        minSdkVersion 9
        targetSdkVersion 21
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile 'com.android.support:appcompat-v7:21.0.0'
    compile 'com.google.android.gms:play-services:7.0.0'
}

(5)作为测试用例,这里是弹出当前运行的应用的包名的代码来证明它:

代码语言:javascript
复制
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ListActivity;
import android.app.ActivityManager.RunningAppProcessInfo;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.List;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        /* put this in the manifest.xml file!!!
           <uses-permission android:name="android.permission.GET_TASKS"/>
*/
        ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
        List<ActivityManager.RunningTaskInfo> taskInfo = am.getRunningTasks(1);

        createDialogAnswer(taskInfo.get(0).topActivity.getPackageName());


}

    public void createDialogAnswer(String msg) {

        AlertDialog.Builder adb;
        LinearLayout linear = new LinearLayout(this);
        linear.setBackgroundColor(Color.RED);
        linear.setOrientation(LinearLayout.VERTICAL);
        adb = new AlertDialog.Builder(this);
        // String team = (string)R.string.app_name;
        adb.setTitle("  Trivia App");
        adb.setView(linear);

        LayoutInflater mInflater = (LayoutInflater) this
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View PopUpView = mInflater.inflate(R.layout.scores, linear);
        TextView mytext = (TextView) PopUpView.findViewById(R.id.QPopUp);

      //  mytext.setTextColor(getResources().getColor(R.color.White));
      //  mytext.setTextSize(getResources().getDimension(R.dimen.aboutApp_text_size));

        mytext.append(msg + " \n");

        adb.setNegativeButton("Quit", myDialogOnClickListener);
        adb.show();

    }

    DialogInterface.OnClickListener myDialogOnClickListener = new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface v, int x) {

        finish();
        }
    };
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42359335

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档