根据设备不同显示不同的错误

huangapple 未分类评论45阅读模式
英文:

Application different error depending on device

问题

Logcart出现错误,像在我的手机上一样。

2020-05-03 17:48:38.715 1785-2071/com.example.tasteportal04b E/libGLESv2: ASUS:glGetString HOOK!name=0x1f01,ret=Adreno(TM)512

在一些设备上,比如三星S6,应用程序无法启动,在我的华硕上运行得很完美。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.tasteportal04b">

    <meta-data
        android:name="com.google.firebase.messaging.default_notification_icon"
        android:resource="@drawable/ic_taste" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    <application
        android:name=".nootificare"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:usesCleartextTraffic="true"
        android:screenOrientation="portrait"
        android:hardwareAccelerated="true"
        android:largeHeap="true"
        >

        <activity android:name=".MainActivity"
            android:hardwareAccelerated="false">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".NewActivity" android:screenOrientation="portrait"
            android:theme="@style/SplashTheme"></activity>
    </application>

</manifest>

NewActivity.java

package com.example.tasteportal04b;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.view.HapticFeedbackConstants;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.widget.ProgressBar;
import android.widget.Toast;

import com.getbase.floatingactionbutton.FloatingActionButton;

import java.util.Objects;

public class NewActivity extends AppCompatActivity {
    Toolbar toolbar;
    private WebView webView;
    private ProgressBar progressbar;

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

        toolbar = findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        Objects.requireNonNull(getSupportActionBar()).setTitle("TASTE Live");
        toolbar.setSubtitle("v1.0");
        toolbar.setLogo(R.mipmap.tasteico);
        toolbar.setTitleTextColor(getResources().getColor(R.color.colortitle));
        toolbar.setSubtitleTextColor(getResources().getColor(R.color.colorsubtitle));

        webView = findViewById(R.id.webView);
        progressbar = findViewById(R.id.progressbar);
        progressbar.setMax(100);

        webView.loadUrl("https://");
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setBuiltInZoomControls(false);
        webView.setBackgroundColor(Color.TRANSPARENT);
        webView.setWebChromeClient(new WebChromeClient() {
            @Override
            public void onProgressChanged(WebView view, int newProgress) {
                super.onProgressChanged(view, newProgress);
                progressbar.setProgress(newProgress);
            }
        });
        FloatingActionButton facebook = findViewById(R.id.Facebook);
        FloatingActionButton classroom = findViewById(R.id.Classroom);
        FloatingActionButton blog = findViewById(R.id.Blog);
        FloatingActionButton youtube = findViewById(R.id.Youtube);
        FloatingActionButton drive = findViewById(R.id.Drive);
        facebook.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
                try {
                    Intent gofb = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://page/"));
                    startActivity(gofb);
                } catch(Exception e) {
                    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/TASTEATB")));
                }
                showToast("T.A.S.T.E Facebook");
            }
        });
        //...(省略其他按钮点击事件的部分)
    }

    //...(省略其他方法的部分)

}

这是您提供的文本的翻译。如果您还有其他需要翻译的内容,请继续提供。

英文:

Logcart is giving error like, on my phone

2020-05-03 17:48:38.715 1785-2071/com.example.tasteportal04b E/libGLESv2: ASUS:glGetString HOOK !!!! name=0x1f01,ret=Adreno (TM) 512

On some devices like Samsung S6, the app is not starting, displaying a crash message, on my Asus works perfectly

    &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    package=&quot;com.example.tasteportal04b&quot;&gt;

    &lt;meta-data
        android:name=&quot;com.google.firebase.messaging.default_notification_icon&quot;
        android:resource=&quot;@drawable/ic_taste&quot; /&gt;

    &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;
    &lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot; /&gt;
    &lt;uses-permission android:name=&quot;android.permission.READ_PHONE_STATE&quot; /&gt;

    &lt;application
        android:name=&quot;.nootificare&quot;
        android:allowBackup=&quot;true&quot;
        android:icon=&quot;@mipmap/ic_launcher&quot;
        android:label=&quot;@string/app_name&quot;
        android:roundIcon=&quot;@mipmap/ic_launcher_round&quot;
        android:supportsRtl=&quot;true&quot;
        android:theme=&quot;@style/AppTheme&quot;
        android:usesCleartextTraffic=&quot;true&quot;
        android:screenOrientation=&quot;portrait&quot;
        android:hardwareAccelerated=&quot;true&quot;
        android:largeHeap=&quot;true&quot;
        &gt;

        &lt;activity android:name=&quot;.MainActivity&quot;
            android:hardwareAccelerated=&quot;false&quot;&gt;
            &lt;intent-filter&gt;
                &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;

                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
        &lt;activity android:name=&quot;.NewActivity&quot; android:screenOrientation=&quot;portrait&quot;
            android:theme=&quot;@style/SplashTheme&quot;&gt;&lt;/activity&gt;
    &lt;/application&gt;

&lt;/manifest&gt;

NewActivity.java
package com.example.tasteportal04b;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.view.HapticFeedbackConstants;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.widget.ProgressBar;
import android.widget.Toast;

import com.getbase.floatingactionbutton.FloatingActionButton;

import java.util.Objects;

public class NewActivity extends AppCompatActivity {
    Toolbar toolbar;
    private WebView webView;
    private ProgressBar progressbar;


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

        toolbar = findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        Objects.requireNonNull(getSupportActionBar()).setTitle(&quot;TASTE Live&quot;);
        toolbar.setSubtitle(&quot;v1.0&quot;);
        toolbar.setLogo(R.mipmap.tasteico);
        toolbar.setTitleTextColor(getResources().getColor(R.color.colortitle));
        toolbar.setSubtitleTextColor(getResources().getColor(R.color.colorsubtitle));

        webView = findViewById(R.id.webView);
        progressbar = findViewById(R.id.progressbar);
        progressbar.setMax(100);

        webView.loadUrl(&quot;https://&quot;);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setBuiltInZoomControls(false);
        webView.setBackgroundColor(Color.TRANSPARENT);
        webView.setWebChromeClient(new WebChromeClient(){
@Override
            public void onProgressChanged(WebView view, int newProgress)
{
    super.onProgressChanged(view, newProgress);
    progressbar.setProgress(newProgress);
}
        });
        FloatingActionButton facebook = findViewById(R.id.Facebook);
        FloatingActionButton classroom = findViewById(R.id.Classroom);
        FloatingActionButton blog = findViewById(R.id.Blog);
        FloatingActionButton youtube = findViewById(R.id.Youtube);
        FloatingActionButton drive = findViewById(R.id.Drive);
        facebook.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
                try {
                    Intent gofb = new Intent(Intent.ACTION_VIEW, Uri.parse(&quot;fb://page/&quot;));
                    startActivity(gofb);
                } catch(Exception e) {
                    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(&quot;https://www.facebook.com/TASTEATB&quot;)));
                }
                showToast(&quot;T.A.S.T.E Facebook&quot;);
            }
        });
        classroom.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
                Intent goclass = new Intent(Intent.ACTION_VIEW, Uri.parse(&quot;https://classroom.google.com/u/0/c/NzgzMTc2MDk5NjNa&quot;));
                startActivity(goclass);
                showToast(&quot;T.A.S.T.E Classroom&quot;);
            }
        });
        blog.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
                Intent goblog = new Intent(Intent.ACTION_VIEW, Uri.parse(&quot;https://&quot;));
                startActivity(goblog);
                showToast(&quot;T.A.S.T.E Blog&quot;);
            }
        });
        youtube.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
                Intent goyt = new Intent(Intent.ACTION_VIEW);
                try {
                goyt.setData(Uri.parse(&quot;https://&quot;));
                goyt.setPackage(&quot;com.google.android.youtube&quot;);
                } catch(Exception e) {
                    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(&quot;https://www.youtube.com/channel/&quot;)));
                }
                startActivity(goyt);
                showToast(&quot;T.A.S.T.E Youtube&quot;);
            }
        });
        drive.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
                Intent godrive = new Intent(Intent.ACTION_VIEW, Uri.parse(&quot;https://&quot;));
                startActivity(godrive);
                showToast(&quot;T.A.S.T.E Drive&quot;);
            }
        });

    }//inchide oncreate
    public void showToast(String message){
        Toast.makeText(this, message, Toast.LENGTH_SHORT).show();}

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_main,menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {

        switch (item.getItemId())
        {
            case R.id.bug:
                Intent gobug = new Intent(Intent.ACTION_VIEW, Uri.parse(&quot;https://&quot;));
                startActivity(gobug);
                showToast(&quot;Raporteaza un bug&quot;);
                break;
            case R.id.update:
                showToast(&quot;Update aplicatie&quot;);
            webView.loadUrl(&quot;https://&quot;);
            break;
        }
        return super.onOptionsItemSelected(item);
    }


}

huangapple
  • 本文由 发表于 2020年5月3日 23:18:15
  • 转载请务必保留本文链接:https://java.coder-hub.com/61576851.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定