2017-10-05 11 views
1

게임에서 Google 광고를 만들려고합니다. Pozirk Ane admob을 사용합니다. Actionscript 3 설정에서 라이브러리 파일과 ane을 추가했습니다. 디버그를 테스트 할 때이 오류가 발생합니다.AIR admob issue # 3500 : 확장 컨텍스트에 cacheInterstitial이라는 메서드가 없습니다.

ANE 링크 오류입니다

https://github.com/pozirk/ANEAdMob

내가 알아낼 수 없었다. /APK/Reklam/Testreklam-app.xml

[SWF] com.pozirk.ads.AdMob - 7065 bytes after decompression 
    [SWF] Testreklam.swf - 45613 bytes after decompression 
    ArgumentError: Error #3500: The extension context does not have a method with the name cacheInterstitial. 
     at flash.external::ExtensionContext/_call() 
     at flash.external::ExtensionContext/call() 
     at com.pozirk.ads.admob::AdMob/cacheInterstitial()[D:\Pozirk\_projects\ANEAdMob\air\AdMob\com\pozirk\ads\admob\AdMob.as:83] 
     at Main()[C:\APK\Reklam\Main.as:43] 
     at runtime::ContentPlayer/loadInitialContent() 
     at runtime::ContentPlayer/playRawContent() 
     at runtime::ContentPlayer/playContent() 
     at runtime::AppRunner/run() 
     at ADLAppEntry/run() 
     at global/runtime::ADLEntry() 

내 Main.as 코드

package { 

    import flash.display.MovieClip; 
    import com.pozirk.ads.admob.AdMob; 
    import com.pozirk.ads.admob.AdParams; 
    import com.pozirk.ads.admob.AdEvent; 
    import flash.events.MouseEvent; 

    public class Main extends MovieClip { 
    private var _bannerAdUID:String = "ca-app-pub-3940256099942544/6300978111";//BİZİMDEGİL 
    private var _intersAdUID:String = "ca-app-pub-4769962435850149/5055329136"; 
    protected var _banner:AdMob = new AdMob(); 
    protected var _inters:AdMob = new AdMob(); 
    private var _initOK:Boolean = false; 
    private var _isShow:Boolean = false; 
    private var _cacheOK:Boolean = false; 

     public function Main() { 
      // constructor code 
      btBanner.addEventListener(MouseEvent.CLICK, showBanner); 
      btInters.addEventListener(MouseEvent.CLICK, showInterstitial); 

      _banner.init(); 
_banner.addEventListener(AdEvent.INIT_OK, onInitEvent); 
_banner.addEventListener(AdEvent.INIT_FAIL, onEvent); 
_banner.addEventListener(AdEvent.BANNER_SHOW_OK, onEvent); 
_banner.addEventListener(AdEvent.BANNER_SHOW_FAIL, onEvent); 
_banner.addEventListener(AdEvent.BANNER_LEFT_APP, onEvent); 
_banner.addEventListener(AdEvent.BANNER_OPENED, onEvent); 
_banner.addEventListener(AdEvent.BANNER_CLOSED, onEvent); 

_inters.init(); 
_inters.addEventListener(AdEvent.INIT_OK, onInitEvent); 
_inters.addEventListener(AdEvent.INIT_FAIL, onEvent); 
_inters.addEventListener(AdEvent.INTERSTITIAL_SHOW_OK, onEvent); 
_inters.addEventListener(AdEvent.INTERSTITIAL_SHOW_FAIL, onEvent); 
_inters.addEventListener(AdEvent.INTERSTITIAL_CACHE_OK, onCacheEvent); 
_inters.addEventListener(AdEvent.INTERSTITIAL_CACHE_FAIL, onEvent); 
_inters.addEventListener(AdEvent.INTERSTITIAL_LEFT_APP, onEvent); 
_inters.addEventListener(AdEvent.INTERSTITIAL_OPENED, onEvent); 
_inters.addEventListener(AdEvent.INTERSTITIAL_CLOSED, onCloseIntersEvent); 

_inters.cacheInterstitial(_intersAdUID); 
     } 


     protected function onEvent(event:AdEvent):void { 

} 

protected function onInitEvent(event:AdEvent):void { 
     _initOK = true; 
} 

protected function onCacheEvent(event:AdEvent):void { 
     _cacheOK = true; 
} 

protected function onCloseIntersEvent(event:AdEvent):void { 
     _inters.cacheInterstitial(_intersAdUID); 
} 


//////////// 


private function showBanner(e:MouseEvent):void { 
     if(_initOK) { 
       if(!_isShow) { 
         _banner.show(_bannerAdUID, AdParams.SIZE_SMART_BANNER, AdParams.HALIGN_CENTER, AdParams.VALIGN_BOTTOM); 
         _isShow = true; 
       }else { 
         _banner.hide(); 
         _isShow = false; 
       } 
     } else { 
       trace("Banner Not Ready."); 
     } 
} 

private function showInterstitial(e:MouseEvent):void { 
     if(_initOK && _cacheOK) { 
       _inters.showInterstitial(); 
     } else { 
       trace("Inters Not Ready."); 
     } 
} 







    } 

} 

APP XML 파일 코드

를 : 시작하고 URL의 C를 사용하여 플레이어에 연결을 시도

<?xml version="1.0" encoding="UTF-8" standalone="no" ?> 
<application xmlns="http://ns.adobe.com/air/application/24.0"> 
    <id>Testreklam</id> 
    <versionNumber>1.0.0</versionNumber> 
    <versionLabel/> 
    <filename>Testreklam</filename> 
    <description/> 
<!-- To localize the description, use the following format for the description element.<description><text xml:lang="en">English App description goes here</text><text xml:lang="fr">French App description goes here</text><text xml:lang="ja">Japanese App description goes here</text></description>--> 
    <name>Testreklam</name> 
<!-- To localize the name, use the following format for the name element.<name><text xml:lang="en">English App name goes here</text><text xml:lang="fr">French App name goes here</text><text xml:lang="ja">Japanese App name goes here</text></name>--> 
    <copyright/> 
    <initialWindow> 
    <content>Testreklam.swf</content> 
    <systemChrome>standard</systemChrome> 
    <transparent>false</transparent> 
    <visible>true</visible> 
    <fullScreen>true</fullScreen> 
    <aspectRatio>portrait</aspectRatio> 
    <renderMode>direct</renderMode> 
    <autoOrients>false</autoOrients></initialWindow> 
    <icon> 
    <image72x72>AppIconsForPublish/Medal-2-icon.png</image72x72> 
    </icon> 
    <customUpdateUI>false</customUpdateUI> 
    <allowBrowserInvocation>false</allowBrowserInvocation> 
    <android> 
     <manifestAdditions> 
     <![CDATA[<manifest><uses-permission android:name="android.permission.INTERNET"/><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/><application> 
<meta-data android:name="com.google.android.gms.version" android:value="4323000" /> <!-- should be android:value="@integer/google_play_services_version" --> <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> 
</application></manifest>]]> 
    </manifestAdditions> 
    </android> 
    <versionLabel> </versionLabel> 
    <extensions> 
    <extensionID>com.pozirk.ads.AdMob</extensionID> 
    </extensions> 
</application> 

답변

1

(1) _inters 자신의 이벤트 리스너를 보다 앞에 넣으십시오._inters.init();
(init()이 발생하면이 방법으로 청취자가 준비 됨).

(2)이 오류에 대한 :

ArgumentError: Error #3500:
"The extension context does not have a method with the name cacheInterstitial ."

는 실제 장치의 예에 코드를 테스트 해보십시오 : 안드로이드. 데스크톱 디버거에서는 작동하지 않습니다.
line 41 of AdMob.as가 (기능 init():void) ... 당신은 if(err.errorID == 3500)를 찾을 참조 :

catch(err:Error) 
{ 
    var e:AdEvent = null; 
    if(err.errorID == 3500) 
     e = new AdEvent(AdEvent.INIT_FAIL, "Isn't it clear, that ANDROID Extension will NOT work on PC/Mac???"); 
    else 
     e = new AdEvent(AdEvent.INIT_FAIL, "ANE was not properly added to your project."); 
    this.dispatchEvent(e); 
}