This worked for me:
Instead of importing the eclipse project into Android Studio,
(1) Create a new Android Studio project with the package name that you have already put on the Google Play Store but use all lower case.
(2) Then copy all your files into the Android Studio project.
(3) Change the package ID in the build.gradle (Module App) file with the original package name with upper case (see below) and sync (this will create the package name in the apk with the original package name with upper case chars and it will upload to the Google Play Store and replace your old one!!!
(4) This installed the apk (with uppercase package name) onto my test phone and it worked perfectly.
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) as a test case here is code that pops up the currently running app's package name to proof it:
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();
}
};