Android应用未在真实手机上运行

时间:2014-12-29 17:36:48

标签: java android opengl-es android-webview ads

我的Android应用程序在模拟器上正常运行但是当我将其导出到我的moto-g 4.4.4 android时,它会在插页式广告加载后重新启动。

import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.InterstitialAd;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.widget.ProgressBar;

@SuppressLint("SetJavaScriptEnabled")
public class MainActivity extends ActionBarActivity {

    private InterstitialAd interstitial;
    private WebView myWebView;
    private ProgressBar progress;
    private AdRequest adrequestI;
    private AdView adviewB;

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

        /*
         * Initialize AdView Banner Ad
         */
        adviewB = (AdView) this.findViewById(R.id.adViewB1);
        AdRequest adrequestB1 = new AdRequest.Builder().build();
        adviewB.loadAd(adrequestB1);

        /*
         * Initialize WebView
         */
        myWebView = (WebView) findViewById(R.id.WebView);
        myWebView.setWebChromeClient(new MyWebViewClient());
        myWebView.clearCache(true);
        myWebView.clearHistory();
        myWebView.getSettings().setJavaScriptEnabled(true);
        myWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);

        /*
         * Initialize Progressbar
         */     
        progress = (ProgressBar) findViewById(R.id.progressBar);
        progress.setMax(100);

        /*
         * Initialize Interstitial Ad
         */
        adrequestI = new AdRequest.Builder().build();
        interstitial = new InterstitialAd(this);
        interstitial.setAdUnitId("ca-app-pub-00000");
        interstitial.loadAd(adrequestI);
        interstitial.setAdListener(new AdListener(){
            @Override
            public void onAdLoaded() {      
                if (interstitial.isLoaded()) {
                    interstitial.show();                        
                    myWebView.setVisibility(View.VISIBLE);
                    myWebView.loadUrl("https://m.youtube.com/#/channel/yyyyy_xxxxx_zzzzz");
                    MainActivity.this.progress.setProgress(0);
                }
            }   
            @Override
            public void onAdOpened() {
            }   
            @Override
            public void onAdFailedToLoad(int errorCode) {                   
                myWebView.setVisibility(View.VISIBLE);
                myWebView.loadUrl("https://m.youtube.com/#/channel/yyyyy_xxxxx_zzzzz");
                MainActivity.this.progress.setProgress(0);
            }
        });

    }

    /*
     * Creating webview client for showing progressbar for url loading
     */
    private class MyWebViewClient extends WebChromeClient { 
        @Override
        public void onProgressChanged(WebView view, int newProgress) {          
            MainActivity.this.setValue(newProgress);
            super.onProgressChanged(view, newProgress);
        }

        @SuppressWarnings("unused")
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
                System.out.println("Errorcode - "+errorCode+"\nDesc - "+description+"\n");
        }
    }   
    public void setValue(int progress) {
        this.progress.setProgress(progress);        
    }

}

在我的应用程序中,我正在打开youtube,twitter,facebook和wikipedia weburl,我在模拟器上得到的错误很少,但app工作正常。

12-29 22:22:34.465: E/libEGL(542): call to OpenGL ES API with no current context (logged once per thread)
12-29 22:22:34.475: E/libEGL(542): call to OpenGL ES API with no current context (logged once per thread)
12-29 22:22:34.485: E/libEGL(542): call to OpenGL ES API with no current context (logged once per thread)
12-29 22:22:34.496: E/libEGL(542): call to OpenGL ES API with no current context (logged once per thread)
12-29 22:22:34.515: E/libEGL(542): call to OpenGL ES API with no current context (logged once per thread)
12-29 22:22:42.656: E/Web Console(542): Refused to display document because display forbidden by X-Frame-Options.
12-29 22:22:42.656: E/Web Console(542):  at null:1
12-29 22:23:09.666: E/Web Console(542): TypeError: Cannot call method 'getItem' of null at http://bits.wikimedia.org/en.wikipedia.org/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=minerva&version=20141217T214024Z:150

有人可以帮忙解决这个问题吗?

更新 - 在设备上运行时出现错误日志

12-30 20:14:23.786: E/MDMCTBK(330): MdmCutbackHndler,Could not open ''
12-30 20:14:23.871: E/MDMCTBK(330): MdmCutbackHndler,Could not open ''
12-30 20:14:24.013: E/AudioManagerAndroid(7746): BLUETOOTH permission is missing!
12-30 20:14:26.186: E/NetRetryLog(5029): network comongclass com.keniu.security.update.b.ifalse
12-30 20:14:26.187: E/NetRetryLog(5029): network comongclass com.keniu.security.update.c.a.efalse
12-30 20:14:26.538: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:14:26.659: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:14:26.885: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:14:26.929: E/BitmapFactory(1137): Unable to decode stream: java.io.FileNotFoundException: /: open failed: EISDIR (Is a directory)
12-30 20:14:26.932: E/patts(7683): [io_section_tags.cc:114] Opening tag "F0-BOX-COX-LAMBDA" not found
12-30 20:14:26.946: E/BitmapFactory(1137): Unable to decode stream: java.io.FileNotFoundException: /: open failed: EISDIR (Is a directory)
12-30 20:14:27.138: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:14:27.508: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:14:27.519: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:14:27.653: E/PhoneMonitor(7964): onOtaspChanged old =0, new =3
12-30 20:14:27.906: E/MmsConfig(8010): MmsConfig.loadMmsSettings mms_config.xml missing uaProfUrl setting
12-30 20:14:27.910: E/MmsConfig(8010): MmsConfig.loadMmsSettings mms_config.xml missing uaProfUrl setting
12-30 20:14:28.622: E/AudioManagerAndroid(8058): BLUETOOTH permission is missing!
12-30 20:14:30.801: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:14:30.842: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:14:30.857: E/rsC++(1397): RS Message thread exiting.
12-30 20:14:31.487: E/GCoreFlp(1579): Bound FusedProviderService with LocationManager
12-30 20:14:32.097: E/AudioManagerAndroid(8271): BLUETOOTH permission is missing!
12-30 20:14:32.447: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:14:32.713: E/NetRetryLog(5029): network comongclass com.keniu.security.update.b.ifalse
12-30 20:14:32.713: E/NetRetryLog(5029): network comongclass com.keniu.security.update.c.a.efalse
12-30 20:14:32.744: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:14:33.342: E/AuthorizationBluetoothService(1477): Proximity feature is not enabled.
12-30 20:14:34.300: E/SQLiteLog(8425): (1) no such table: mmsconfig
12-30 20:14:34.314: E/Babel(8425): canonicalizeMccMnc: invalid mccmnc nullnull
12-30 20:14:34.884: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:14:34.906: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:14:35.293: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:14:35.732: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:14:35.827: E/patts(8214): [io_section_tags.cc:114] Opening tag "F0-BOX-COX-LAMBDA" not found
12-30 20:14:35.859: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:14:36.121: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:14:41.345: E/ActivityThread(8058): Activity com.ahl.wwe.MainActivity has leaked ServiceConnection com.google.android.gms.common.b@654813c8 that was originally bound here
12-30 20:14:41.345: E/ActivityThread(8058): android.app.ServiceConnectionLeaked: Activity com.ahl.wwe.MainActivity has leaked ServiceConnection com.google.android.gms.common.b@654813c8 that was originally bound here
12-30 20:14:41.345: E/ActivityThread(8058):     at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:979)
12-30 20:14:41.345: E/ActivityThread(8058):     at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:873)
12-30 20:14:41.345: E/ActivityThread(8058):     at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1690)
12-30 20:14:41.345: E/ActivityThread(8058):     at android.app.ContextImpl.bindService(ContextImpl.java:1673)
12-30 20:14:41.345: E/ActivityThread(8058):     at android.content.ContextWrapper.bindService(ContextWrapper.java:517)
12-30 20:14:41.345: E/ActivityThread(8058):     at com.google.android.gms.ads.identifier.a.b(SourceFile:330)
12-30 20:14:41.345: E/ActivityThread(8058):     at com.google.android.gms.ads.identifier.a.a(SourceFile:187)
12-30 20:14:41.345: E/ActivityThread(8058):     at com.google.android.gms.ads.identifier.a.a(SourceFile:173)
12-30 20:14:41.345: E/ActivityThread(8058):     at com.google.android.a.u.a(SourceFile:79)
12-30 20:14:41.345: E/ActivityThread(8058):     at com.google.android.a.u.doInBackground(SourceFile:75)
12-30 20:14:41.345: E/ActivityThread(8058):     at android.os.AsyncTask$2.call(AsyncTask.java:288)
12-30 20:14:41.345: E/ActivityThread(8058):     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
12-30 20:14:41.345: E/ActivityThread(8058):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
12-30 20:14:41.345: E/ActivityThread(8058):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
12-30 20:14:41.345: E/ActivityThread(8058):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
12-30 20:14:41.345: E/ActivityThread(8058):     at java.lang.Thread.run(Thread.java:811)
12-30 20:14:41.717: E/BitmapFactory(1137): Unable to decode stream: java.io.FileNotFoundException: /: open failed: EISDIR (Is a directory)
12-30 20:14:41.740: E/BitmapFactory(1137): Unable to decode stream: java.io.FileNotFoundException: /: open failed: EISDIR (Is a directory)
12-30 20:14:46.192: E/NetRetryLog(5029): NetReqMananger wifiComing()
12-30 20:14:46.196: E/NetRetryLog(5029): class com.keniu.security.update.b.k mbScu= true bAgin= true
12-30 20:14:46.197: E/NetRetryLog(5029): getversions retry
12-30 20:14:46.224: E/NetRetryLog(5029): class com.keniu.security.update.c.a.e startDoqnload
12-30 20:14:50.638: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:14:50.768: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:14:51.020: E/channellog(5029): getversions=
12-30 20:14:52.721: E/NetRetryLog(5029): NetReqMananger wifiComing()
12-30 20:14:52.721: E/NetRetryLog(5029): class com.keniu.security.update.b.k mbScu= true bAgin= true
12-30 20:14:52.721: E/NetRetryLog(5029): class com.keniu.security.update.c.a.e startDoqnload
12-30 20:14:56.708: E/BitmapFactory(1137): Unable to decode stream: java.io.FileNotFoundException: /: open failed: EISDIR (Is a directory)
12-30 20:14:56.727: E/BitmapFactory(1137): Unable to decode stream: java.io.FileNotFoundException: /: open failed: EISDIR (Is a directory)
12-30 20:15:01.163: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:15:01.206: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:15:01.477: E/AuthorizationBluetoothService(1477): Proximity feature is not enabled.
12-30 20:15:01.585: E/DrmWidevineDash(271): sion_buffer g_wv_fhandle->ion_sbuffer  0x0xb5284000
12-30 20:15:02.550: E/chromium(8058): [ERROR:ssl_client_socket_openssl.cc(200)] OpenSSL SYSCALL error, earliest error code in error queue: 0, errno: 0
12-30 20:15:02.550: E/chromium(8058): [ERROR:ssl_client_socket_openssl.cc(845)] handshake failed; returned 0, SSL error code 5, net_error -107
12-30 20:15:06.251: E/AppsCustomizePagedView(1397): Widget ComponentInfo{com.hungama.myplay.activity/com.hungama.myplay.activity.player.PlayerWidgetProvider} can not fit on this device (640, 144)
12-30 20:15:07.383: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:15:08.535: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:15:09.722: E/MDMCTBK(330): MdmCutbackHndler,Could not open ''
12-30 20:15:09.748: E/MDMCTBK(330): MdmCutbackHndler,Could not open ''
12-30 20:15:11.354: E/AppsCustomizePagedView(1397): Widget ComponentInfo{com.hungama.myplay.activity/com.hungama.myplay.activity.player.PlayerWidgetProvider} can not fit on this device (640, 144)
12-30 20:15:11.769: E/GCoreFlp(1579): Bound FusedProviderService with LocationManager
12-30 20:15:11.812: E/SQLiteLog(8966): (1) no such table: mmsconfig
12-30 20:15:11.817: E/Babel(8966): canonicalizeMccMnc: invalid mccmnc nullnull
12-30 20:15:11.824: E/BitmapFactory(1137): Unable to decode stream: java.io.FileNotFoundException: /: open failed: EISDIR (Is a directory)
12-30 20:15:11.840: E/BitmapFactory(1137): Unable to decode stream: java.io.FileNotFoundException: /: open failed: EISDIR (Is a directory)
12-30 20:15:12.166: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:15:12.198: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:15:12.210: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:15:12.319: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:15:13.210: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:15:13.374: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:15:14.139: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner
12-30 20:15:14.444: A/ProcessStats(968): Starting service ServiceState{66035318 com.google.android.youtube.app.remote.YouTubeTvRouteProviderService pkg=com.google.android.youtube proc=66035318} without owner

更新 - 添加额外的Blutooth权限后,仍然存在以下错误

01-01 15:32:43.397: E/ActivityThread(27865): Activity MainActivity has leaked ServiceConnection com.google.android.gms.common.b@65443ae8 that was originally bound here
01-01 15:32:43.397: E/ActivityThread(27865): android.app.ServiceConnectionLeaked: Activity com.ahl.wwe.MainActivity has leaked ServiceConnection com.google.android.gms.common.b@65443ae8 that was originally bound here
01-01 15:32:43.397: E/ActivityThread(27865):    at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:979)
01-01 15:32:43.397: E/ActivityThread(27865):    at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:873)
01-01 15:32:43.397: E/ActivityThread(27865):    at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1690)
01-01 15:32:43.397: E/ActivityThread(27865):    at android.app.ContextImpl.bindService(ContextImpl.java:1673)
01-01 15:32:43.397: E/ActivityThread(27865):    at android.content.ContextWrapper.bindService(ContextWrapper.java:517)
01-01 15:32:43.397: E/ActivityThread(27865):    at com.google.android.gms.ads.identifier.a.b(SourceFile:330)
01-01 15:32:43.397: E/ActivityThread(27865):    at com.google.android.gms.ads.identifier.a.a(SourceFile:187)
01-01 15:32:43.397: E/ActivityThread(27865):    at com.google.android.gms.ads.identifier.a.a(SourceFile:173)
01-01 15:32:43.397: E/ActivityThread(27865):    at com.google.android.a.u.a(SourceFile:79)
01-01 15:32:43.397: E/ActivityThread(27865):    at com.google.android.a.u.doInBackground(SourceFile:75)
01-01 15:32:43.397: E/ActivityThread(27865):    at android.os.AsyncTask$2.call(AsyncTask.java:288)
01-01 15:32:43.397: E/ActivityThread(27865):    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
01-01 15:32:43.397: E/ActivityThread(27865):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
01-01 15:32:43.397: E/ActivityThread(27865):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
01-01 15:32:43.397: E/ActivityThread(27865):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
01-01 15:32:43.397: E/ActivityThread(27865):    at java.lang.Thread.run(Thread.java:811)

我想由于这些错误,活动正在重新启动。我想我不会处理非页内广告。当广告被调用时,活动会发生什么?

注意:完全删除广告..现在应用正常!嗯......

0 个答案:

没有答案