问题
I just finished up publishing an app to the Google Play store, but when I downloaded it from the store on another phone, it didn't run at all. I set up my libgdx app project based off of this website:
http://obviam.net/index.php/getting-started-in-android-game-development-with-libgdx-create-a-working-prototype-in-a-day-tutorial-part-1/comment-page-2/
which basically had me type all my game code in a Java Project, then launch that from an Android Application Project.
Here is my code for the Android Application Project. Any ideas why this wouldn't launch from the Google Play Store? I'm guessing because the APK does not include the Java Project code, but how do I make it include that?
package ball.activity;
import greenball.activity.GreenBall;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.android.AndroidApplication;
import activity.ball.greenball_android.R;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.Toast;
public class GreenBallActivity extends AndroidApplication implements ApplicationListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_green_ball);
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
cfg.useGL20 = false;
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
initialize(new GreenBall(), cfg);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.green_ball, menu);
return true;
}
@Override
public void create() {
// TODO Auto-generated method stub
}
@Override
public void resize(int width, int height) {
// TODO Auto-generated method stub
}
@Override
public void render() {
// TODO Auto-generated method stub
}
@Override
public void pause() {
// TODO Auto-generated method stub
}
@Override
public void resume() {
// TODO Auto-generated method stub
}
@Override
public void dispose() {
// TODO Auto-generated method stub
}
}
回答1:
It sounds like there may be a problem with how your app is signed. It would have worked on your test device with just a debug key, but not on any other device. Android requires all apps to be signed before it will install them.
来源:https://stackoverflow.com/questions/24092753/publish-libgdx-game-to-google-play