2013-08-10 2 views
5

안녕하세요 Android 용 pygame 하위 세트로 작성된 앱용 Admob을 통합하는 솔루션을 알고 싶습니다. 내가 https://developers.google.com/mobile-ads-sdk/docs/admob/fundamentals#android 이 구글 다음 : 나는 내가 할 수있는 방법 :(android의 pygame과 Admob 통합

TRY 일이 없습니다 t은 나를 위해 작동 :(

여전히 작업 아무것도 '를했던 것보다 시도 솔루션은 어떤 코드 변경을 만 build.xml 파일 수정이 없습니다 그것은 didt 나 :(

TRY 2를 작동합니다. 도 solutio 아래 시도 PythonActivity.java을 해킹 시도 :http://www.michenux.net/android-admob-tutorial-461.html 은 또한 나를 위해 일 :(

TRY 3 did't. 그러나 관련 오류 아래에 점점. GoogleAdMobAdsSdk-6.4.1.jar\ pgs4a-0.9.4 \ libs PATH 여전히 오류 종류 아래에 있습니다. 내가 오류가 아래 얻을 내 응용 프로그램을 실행하면

protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
    //vrbilgi 

     setContentView(R_Layout_main); 
    // setContentView(r.layout.main); 

      // Create the adView 
    //  adView = new AdView(this, AdSize.BANNER, MY_AD_UNIT_ID); 
      adView = new AdView(this, AdSize.BANNER,"a1520527530b444"); 

      // Lookup your LinearLayout assuming it's been given 
      // the attribute android:id="@+id/mainLayout" 
      // LinearLayout layout = (LinearLayout)findViewById(R.id.mainLayout); 
      LinearLayout layout = (LinearLayout)findViewById(R_adView); 

      // Add the adView to it 
      layout.addView(adView); 

      // Initiate a generic request to load it with an ad 
      adView.loadAd(new AdRequest()); 



    //vrbilgi 

:

다음은 내 코드입니다 어떤 도움을 주시기 바랍니다.

I/ActivityManager( 66): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.number.game/org.renpy.android.PythonActivity } 
I/ActivityManager( 66): Start proc com.number.game:python for activity com.number.game/org.renpy.android.PythonActivity: pid=1214 uid=10036 gids={1015, 3003} 
I/ActivityManager( 66): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.number.game/org.renpy.android.PythonActivity } 
E/Ads  (1214): The android:configChanges value of the com.google.ads.AdActivity must include screenLayout. 
E/Ads  (1214): The android:configChanges value of the com.google.ads.AdActivity must include uiMode. 
E/Ads  (1214): The android:configChanges value of the com.google.ads.AdActivity must include screenSize. 
E/Ads  (1214): The android:configChanges value of the com.google.ads.AdActivity must include smallestScreenSize. 
E/Ads  (1214): You must have AdActivity declared in AndroidManifest.xml with configChanges. 
E/Ads  (1214): You must have AdActivity declared in AndroidManifest.xml with configChanges. 
D/AndroidRuntime(1214): Shutting down VM 
W/dalvikvm(1214): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 
D/dalvikvm(1214): GC_FOR_MALLOC freed 3598 objects/323688 bytes in 110ms 
E/AndroidRuntime(1214): FATAL EXCEPTION: main 
E/AndroidRuntime(1214): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.number.game/org.renpy.android.PythonActivity}: java.lang.ClassCastException: com.google.ads.AdView 
E/AndroidRuntime(1214):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) 
E/AndroidRuntime(1214):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 
E/AndroidRuntime(1214):  at android.app.ActivityThread.access$2300(ActivityThread.java:125) 
E/AndroidRuntime(1214):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 
E/AndroidRuntime(1214):  at android.os.Handler.dispatchMessage(Handler.java:99) 
E/AndroidRuntime(1214):  at android.os.Looper.loop(Looper.java:123) 
E/AndroidRuntime(1214):  at android.app.ActivityThread.main(ActivityThread.java:4627) 
E/AndroidRuntime(1214):  at java.lang.reflect.Method.invokeNative(Native Method) 
E/AndroidRuntime(1214):  at java.lang.reflect.Method.invoke(Method.java:521) 
E/AndroidRuntime(1214):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 
E/AndroidRuntime(1214):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 
E/AndroidRuntime(1214):  at dalvik.system.NativeStart.main(Native Method) 
E/AndroidRuntime(1214): Caused by: java.lang.ClassCastException: com.google.ads.AdView 
E/AndroidRuntime(1214):  at org.renpy.android.PythonActivity.onCreate(PythonActivity.java:77) 
E/AndroidRuntime(1214):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 
E/AndroidRuntime(1214):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 
E/AndroidRuntime(1214):  ... 11 more 
W/ActivityManager( 66): Force finishing activity com.number.game/org.renpy.android.PythonActivity 
W/ActivityManager( 66): Activity pause timeout for HistoryRecord{43fec778 com.number.game/org.renpy.android.PythonActivity} 
I/Process (1214): Sending signal. PID: 1214 SIG: 9 
W/InputManagerService( 66): Window already focused, ignoring focus gain of: [email protected] 
I/ActivityManager( 66): Process com.number.game:python (pid 1214) has died. 
W/ActivityManager( 66): Activity destroy timeout for HistoryRecord{43fec778 com.number.game/org.renpy.android.PythonActivity} 
+0

님은 뉴스를 받았습니까? 나는 renpy 게임을 너무 releade 싶습니다. 하지만 광고를 넣지 않으면 쓸모가 없습니다. – Goot

답변

1

이것은 아마도 귀하가 찾고있는 것일 수 있습니다. 나는 이것이 매우 늦었다는 것을 알고 있지만, 미래의 사람들은 이로부터 이익을 얻을 수도있다. 누군가가 최근 몹 지원이 pgs4a의 fork했다처럼

@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 

    AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration(); 
    cfg.useGL20 = true; 
    cfg.useAccelerometer = false; 
    cfg.useCompass = false; 

    // Create the layout 
    RelativeLayout layout = new RelativeLayout(this); 

    // Do the stuff that initialize() would do for you 
    requestWindowFeature(Window.FEATURE_NO_TITLE); 
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
        WindowManager.LayoutParams.FLAG_FULLSCREEN); 
    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); 

    // Create the pygame View 
    View gameView = initializeForView(R_layout_main, cfg); 

    // Create and setup the AdMob view 
    adView = new AdView(this, AdSize.BANNER, "your id here"); // Put in your secret key here 
    adView.loadAd(new AdRequest()); 

    // Add the pygame view 
    layout.addView(gameView); 

    // Add the AdMob view 
    RelativeLayout.LayoutParams adParams = 
      new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, 
          RelativeLayout.LayoutParams.WRAP_CONTENT); 
    adParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); 
    adParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); 

    layout.addView(adView, adParams); 

    // Hook it all up 
    setContentView(layout); 
} 
0

는 것 같습니다. 글을 쓰는 당시에는 문서가있는 것처럼 보이지 않았고 시도하지도 않았지만 확실히 살펴볼 가치가 있습니다.