安卓 GLES20.glDrawArrays 在小米手机上报错 10C

GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, firstVertex, vertexCount)在小米手机报错
#3707 SIGSEGV(SEGV_MAPERR)

1个回答

你是干什么报的错,描述的清楚一点,因为小米的兼容本来就不好。

zjandandroid
zjandandroid 做视频通话,然后采集本地摄像头数据进行编码发送
接近 2 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
opengl android,为什么我的三角形不显示都是照着写的我的render哪里写错了吗
package com.cheerchip.opengl5; import android.opengl.GLES20; import android.opengl.GLSurfaceView; import android.opengl.Matrix; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; /** * Created by noname on 2017/6/28. */ public class GLRender implements GLSurfaceView.Renderer { //顶点颜色 private final String vertexShaderCode = "attribute vec4 vPosition;" + "void main() {" + " gl_Position = vPosition;" + "}"; //片元颜色 private final String fragmentShaderCode = "precision mediump float;" + "uniform vec4 vColor;" + "void main() {" + " gl_FragColor = vColor;" + "}"; private int programs; //三角形顶点 private float[] vertexes = new float[]{ 1f, 0f, 0f, 0f, 1f, 0f, -1f, 0f, 0f }; private FloatBuffer floatBuffer; @Override public void onSurfaceCreated(GL10 gl, EGLConfig config) { GLES20.glClearColor(0.5f,0.5f,0.5f,1.0f);//设置背景色灰色 init(); //生成shader调色板 //顶点和片元一般两种 int verextype = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER); GLES20.glShaderSource(verextype, vertexShaderCode); GLES20.glCompileShader(verextype); int fragmenttype = GLES20.glCreateShader(GLES20.GL_FRAGMENT_SHADER); GLES20.glShaderSource(fragmenttype, fragmentShaderCode); GLES20.glCompileShader(fragmenttype); // GLES20. programs = GLES20.glCreateProgram(); //连接到调色板 GLES20.glAttachShader(programs, verextype); GLES20.glAttachShader(programs, fragmenttype); //连接programs GLES20.glLinkProgram(programs); } @Override public void onSurfaceChanged(GL10 gl, int width, int height) { GLES20.glViewport(0,0,width,height); float ratio = (float) width / height; // create a projection matrix from device screen geometry //Matrix.frustumM(mProjMatrix, 0, -ratio, ratio, -1, 1, 3, 7); } @Override public void onDrawFrame(GL10 gl) { GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT|GLES20.GL_DEPTH_BUFFER_BIT); GLES20.glUseProgram(programs); //获取顶点着色器的vPosition成员句柄 int mPositionHandle = GLES20.glGetAttribLocation(programs, "vPositon"); //启用三角形顶点的句柄 GLES20.glEnableVertexAttribArray(mPositionHandle); //准备三角形数据3*4顶点偏移量 GLES20.glVertexAttribPointer(mPositionHandle,3,GLES20.GL_FLOAT,false,3*4,floatBuffer); int uniformhandle= GLES20.glGetUniformLocation(programs,"vColor"); //绘制颜色 GLES20.glUniform4fv(uniformhandle,1,color,0); //h绘制图像 GLES20.glDrawArrays(GLES20.GL_TRIANGLES,0,3); GLES20.glDisableVertexAttribArray(mPositionHandle); } //设置颜色,依次为红绿蓝和透明通道 float color[] = { 1.0f, 1.0f, 1.0f, 1.0f }; // 准备数据 private void init(){ ByteBuffer buffer=ByteBuffer.allocateDirect(vertexes.length*4);//每个数4个字节 buffer.order(ByteOrder.nativeOrder()); floatBuffer = buffer.asFloatBuffer(); floatBuffer.put(vertexes); floatBuffer.position(0); } }
使用OPENGLES2.0在安卓上如何实现增量点绘?
我在iOS上使用openGLES2.0实现了一个增量点绘的功能。 即我点击屏幕的某个位置,则在那个位置增加一个三角形。 我使用的是GLKView,在 -(void)glkView:(GLKView *)view drawInRect:(CGRect)rect; 里调用如下方法 (不clear) glEnableVertexAttribArray(GLKVertexAttribPosition); glVertexAttribPointer(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, sizeof(LineVertex), &vertices[0].pos); glEnableVertexAttribArray(GLKVertexAttribColor); glVertexAttribPointer(GLKVertexAttribColor, 4, GL_FLOAT, GL_FALSE, sizeof(LineVertex), &vertices[0].color); glDrawArrays(GL_TRIANGLES, 0, (GLsizei)count); 得到的结果是正确的。(每次点击屏幕就多一个三角形) 我在安卓做了一样的实现。 在 public void onDrawFrame(GL10 unused) 里调用了如下方法(同样不clear) GLES20.glEnableVertexAttribArray(mPositionHandle); GLES20.glVertexAttribPointer(mPositionHandle, 3, GLES20.GL_FLOAT, false, 7*Float.SIZE/8, verticesBuffer.position(0)); GLES20.glEnableVertexAttribArray(mColorHandle); GLES20.glVertexAttribPointer(mColorHandle, 4, GLES20.GL_FLOAT, false, 7*Float.SIZE/8, verticesBuffer.position(3)); GLES20.glUniformMatrix4fv(mtrxhandle, 1, false, mtrxProjectionAndView, 0); GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, count); 结果就是,每次进入onDrawFrame方法调用glDrawArrays时都会把之前的绘图结果清掉,然后画一个三角形,即永远只有1个三角形。我并没有调用clear。想请教下高手如何能够使用OPENGLES在安卓上实现增量点绘?是否我需要设置某些参数才能够每次渲染新的三角形之前不会删除旧的内容?为什么iOS下的实现和安卓上实现时,基本相同的代码会有不同的结果?我也试过每次glDrawArrays(android上)之前把都把本次绘图和历史绘图结果存成一个新的历史缓冲区,后面每次onDrawFrame都先画一次历史缓冲区的内容,但很快缓冲区就爆了。
OpenGL ES3.0纹理贴图问题,贴图发生错误,无法显示贴图细节是怎么回事啊?
最近在学习OpenGL ES,按照书上教程尝试写了个demo,然后发现在纹理贴图这块遇到问题了,求助各位大佬 程序思路很简单,画5个点然后贴上纹理,但是纹理总是出现错误,下面是截图: ![图片说明](https://img-ask.csdn.net/upload/202002/12/1581502455_517510.jpg) 这个是要贴的纹理,大小为512 \*1024,另外正方形纹理我也试过同样不行 ![图片说明](https://img-ask.csdn.net/upload/202002/12/1581502536_603856.png) 接下来是代码: 首先是Render: ```java package com.example.firstopengl; import android.content.Context; import android.opengl.GLES30; import android.opengl.GLSurfaceView; import android.opengl.Matrix; import com.airhockey.android.objects.Mallet; import com.airhockey.android.objects.Table; import com.airhockey.android.programs.ColorShaderProgram; import com.airhockey.android.programs.TextureShaderProgram; import com.airhockey.android.util.MatrixHelper; import com.airhockey.android.util.TextureHelper; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; public class AirHockeyRender implements GLSurfaceView.Renderer { private final String TAG = "AirHockeyRender"; private final Context context; private final float[] projectionMatrix = new float[16]; private final float[] modelMatrix = new float[16]; private Table table; private Mallet mallet; private TextureShaderProgram textureShaderProgram; private ColorShaderProgram colorShaderProgram; private int texture; public AirHockeyRender(Context context){ this.context = context; } @Override public void onSurfaceCreated(GL10 gl, EGLConfig config) { GLES30.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); table = new Table(); mallet = new Mallet(); textureShaderProgram = new TextureShaderProgram(context); colorShaderProgram = new ColorShaderProgram(context); texture = TextureHelper.loadTexture(context, R.drawable.air_hockey_surface); } @Override public void onDrawFrame(GL10 gl) { GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT); textureShaderProgram.useProgram(); textureShaderProgram.setUniforms(projectionMatrix, texture); table.bindData(textureShaderProgram); table.draw(); colorShaderProgram.useProgram(); colorShaderProgram.setUniform(projectionMatrix); mallet.bindData(colorShaderProgram); mallet.draw(); } @Override public void onSurfaceChanged(GL10 gl, int width, int height) { final float[] temp = new float[16]; //设置视口 GLES30.glViewport(0, 0, width, height); MatrixHelper.perspectiveM(projectionMatrix, 45, (float)width/(float)height, 1f, 10f); Matrix.setIdentityM(modelMatrix, 0); Matrix.translateM(modelMatrix, 0, 0f, 0f, -3.1f); Matrix.rotateM(modelMatrix, 0, -60f, 1f, 0f, 0f); Matrix.multiplyMM(temp, 0 ,projectionMatrix, 0, modelMatrix, 0); System.arraycopy(temp, 0, projectionMatrix, 0, temp.length); } } ``` 接下来是纹理生成相关 ``` package com.airhockey.android.util; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.opengl.GLES30; import android.opengl.GLUtils; import android.util.Log; import com.airhockey.android.Constants; import java.io.ByteArrayOutputStream; import java.nio.ByteBuffer; import java.nio.ByteOrder; public class TextureHelper { private final static String TAG = "TextureHelper"; public static int loadTexture(Context context, int resourceId){ final int[] textureObject = new int[1]; GLES30.glGenTextures(1, textureObject, 0); if(textureObject[0]==0){ if(LoggerConfig.ON){ Log.w(TAG, "Could not generate a new OpenGL texture object"); } return 0; } final BitmapFactory.Options options = new BitmapFactory.Options(); //需要原始的图像数据,而不是缩放的版本 options.inScaled = false; //将图像转换为位图 final Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), resourceId, options); if(bitmap==null){ if(LoggerConfig.ON){ Log.w(TAG, "Resource ID"+resourceId+"could not be decoded"); } GLES30.glDeleteTextures(1, textureObject, 0); return 0; } //告诉opengl纹理调用使用此纹理 GLES30.glBindTexture(GLES30.GL_TEXTURE_2D, textureObject[0]); GLES30.glTexParameteri(GLES30.GL_TEXTURE_2D, GLES30.GL_TEXTURE_MIN_FILTER, GLES30.GL_LINEAR_MIPMAP_LINEAR); GLES30.glTexParameteri(GLES30.GL_TEXTURE_2D, GLES30.GL_TEXTURE_MAG_FILTER, GLES30.GL_LINEAR); GLES30.glTexParameterf(GLES30.GL_TEXTURE_2D, GLES30.GL_TEXTURE_WRAP_S, GLES30.GL_REPEAT); GLES30.glTexParameterf(GLES30.GL_TEXTURE_2D, GLES30.GL_TEXTURE_WRAP_T, GLES30.GL_REPEAT); //将位图加载至opengl中 GLUtils.texImage2D(GLES30.GL_TEXTURE_2D, 0, bitmap, 0); //加载后释放位图,解除绑定 bitmap.recycle(); //生成mip贴图 GLES30.glGenerateMipmap(GLES30.GL_TEXTURE_2D); GLES30.glBindTexture(GLES30.GL_TEXTURE_2D, 0); return textureObject[0]; } } ``` 然后是画的物体: ``` package com.airhockey.android.objects; import android.opengl.GLES30; import com.airhockey.android.Constants; import com.airhockey.android.data.VertexArray; import com.airhockey.android.programs.TextureShaderProgram; public class Table { private static final int POSITION_COMPONENT_COUNT = 2; private static final int TEXTURE_COORDINATES_COMPONENT_COUNT = 2; private static final int STRIDE = (POSITION_COMPONENT_COUNT+TEXTURE_COORDINATES_COMPONENT_COUNT) * Constants.BYTE_PER_FLOAT; private final VertexArray vertexArray; private static final float[] VERTEX_DATA = { //x,y,s,t //三角扇区 0f, 0f, 0.5f, 0.5f, -0.5f, -0.8f, 0.0f, 1.0f, 0.5f, -0.8f, 1.0f, 1.0f, 0.5f, 0.8f, 1.0f, 0.0f, -0.5f, 0.8f, 0.0f, 0.0f, -0.5f, -0.8f, 0.0f, 1.0f // -0.5f, -0.8f, 0f, 1f, // -0.5f, 0.8f, 0f, 0f, // 0.5f, -0.8f, 1f, 1f, // // -0.5f, 0.8f, 0f, 0f, // 0.5f, -0.8f, 1f, 1f, // 0.5f, 0.8f, 1f, 0f }; public Table(){ vertexArray = new VertexArray(VERTEX_DATA); } public void bindData(TextureShaderProgram textureProgram){ vertexArray.setVertexAttribPointer(0, textureProgram.getPositonAttributeLocation(), POSITION_COMPONENT_COUNT, STRIDE); vertexArray.setVertexAttribPointer(POSITION_COMPONENT_COUNT, textureProgram.getTextureCoordinatesAttributeLocation(), TEXTURE_COORDINATES_COMPONENT_COUNT, STRIDE); } public void draw(){ GLES30.glDrawArrays(GLES30.GL_TRIANGLE_FAN, 0, 6); } } ``` 头真的大,研究了好久都没研究出来怎么回事
android OPENGLES 截屏显示问题
先上代码 public class MainActivity extends AppCompatActivity implements GLSurfaceView.Renderer, SurfaceTexture.OnFrameAvailableListener { private MediaProjectionManager mediaProjectionManager; private GLSurfaceView surfaceview; private LinearLayout linearLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); linearLayout = ((LinearLayout) findViewById(R.id.linearlayout)); ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0); } /** * 初始化摄像头 */ private void initCamera() { surfaceview = new GLSurfaceView(this); linearLayout.addView(surfaceview); surfaceview.setEGLContextClientVersion(2); surfaceview.setRenderer(this); } private MediaProjection mediaProjection; @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); mediaProjectionManager = (MediaProjectionManager) getSystemService(MEDIA_PROJECTION_SERVICE); startActivityForResult(mediaProjectionManager.createScreenCaptureIntent(), 0); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); mediaProjection = mediaProjectionManager.getMediaProjection(resultCode, data); initCamera(); } @Override public void onSurfaceCreated(GL10 gl, EGLConfig config) { setupGraphics(); setupVertexBuffer(); setupTexture(); // } private int width=1080; private int height=1920; private MediaPlayer mediaPlayer; @Override public void onSurfaceChanged(GL10 gl, int width, int height) { this.width = width; this.height = height; // if (mediaPlayer == null) { // mediaPlayer = new MediaPlayer(); // mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { // @Override // public void onPrepared(MediaPlayer mp) { // mp.start(); // } // }); // Surface surface = new Surface(videoTexture); // mediaPlayer.setSurface(surface); // surface.release(); // try { // mediaPlayer.setDataSource(Environment.getExternalStorageDirectory().getAbsolutePath()+"/1.mp4"); // mediaPlayer.prepareAsync(); // } catch (IOException e) { // e.printStackTrace(); // } // } else { // mediaPlayer.start(); // } Surface surface = new Surface(videoTexture); VirtualDisplay display = mediaProjection.createVirtualDisplay("aa", 1080, 1920, 32, DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR, surface, null, null); } private float[] videoTextureTransform = new float[16]; @Override public void onDrawFrame(GL10 gl) { synchronized (this) { if (frameAvailable) { videoTexture.updateTexImage(); videoTexture.getTransformMatrix(videoTextureTransform); frameAvailable = false; } } GLES20.glActiveTexture(GLES20.GL_TEXTURE0); // GLES20.glBindTexture(GL_TEXTURE_EXTERNAL_OES, textures[0]); // Draw a rectangle and render the video frame as a texture on it. GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4); // GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); // GLES20.glViewport(0, 0, width, height); this.drawTexture(); } private int shaderProgram; int textureParamHandle; int textureCoordinateHandle; int positionHandle; int textureTranformHandle; private static short drawOrder[] = {0, 1, 2, 0, 2, 3}; private FloatBuffer vertexBuffer; private ShortBuffer drawListBuffer; private static float squareSize = 0.5f; private static float squareCoords[] = { -squareSize, squareSize, // top left -squareSize, -squareSize, // bottom left squareSize, -squareSize, // bottom right squareSize, squareSize}; // top right private FloatBuffer textureBuffer; private float textureCoords[] = { 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}; private int[] textures = new int[1]; private SurfaceTexture videoTexture; private void setupGraphics() { final String vertexShader = RawResourceReader.readTextFileFromRawResource(this, R.raw.vetext_sharder); final String fragmentShader = RawResourceReader.readTextFileFromRawResource(this, R.raw.fragment_sharder); final int vertexShaderHandle = ShaderHelper.compileShader(GLES20.GL_VERTEX_SHADER, vertexShader); final int fragmentShaderHandle = ShaderHelper.compileShader(GLES20.GL_FRAGMENT_SHADER, fragmentShader); shaderProgram = ShaderHelper.createAndLinkProgram(vertexShaderHandle, fragmentShaderHandle, new String[]{"texture", "vPosition", "vTexCoordinate", "textureTransform"}); GLES20.glUseProgram(shaderProgram); textureParamHandle = GLES20.glGetUniformLocation(shaderProgram, "texture"); textureCoordinateHandle = GLES20.glGetAttribLocation(shaderProgram, "vTexCoordinate"); positionHandle = GLES20.glGetAttribLocation(shaderProgram, "vPosition"); textureTranformHandle = GLES20.glGetUniformLocation(shaderProgram, "textureTransform"); } private void setupVertexBuffer() { // Draw list buffer ByteBuffer dlb = ByteBuffer.allocateDirect(drawOrder.length * 2); dlb.order(ByteOrder.nativeOrder()); drawListBuffer = dlb.asShortBuffer(); drawListBuffer.put(drawOrder); drawListBuffer.position(0); // Initialize the texture holder ByteBuffer bb = ByteBuffer.allocateDirect(squareCoords.length * 4); bb.order(ByteOrder.nativeOrder()); vertexBuffer = bb.asFloatBuffer(); vertexBuffer.put(squareCoords); vertexBuffer.position(0); } private void setupTexture() { ByteBuffer texturebb = ByteBuffer.allocateDirect(textureCoords.length * 4); texturebb.order(ByteOrder.nativeOrder()); textureBuffer = texturebb.asFloatBuffer(); textureBuffer.put(textureCoords); textureBuffer.position(0); // Generate the actual texture GLES20.glActiveTexture(GLES20.GL_TEXTURE0); GLES20.glGenTextures(1, textures, 0); // checkGlError("Texture generate"); GLES20.glBindTexture(GLES20.GL_TEXTURE_BINDING_2D, textures[0]); GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST); GLES20.glTexParameterf(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR); // checkGlError("Texture bind"); videoTexture = new SurfaceTexture(textures[0]); videoTexture.setOnFrameAvailableListener(this); } private boolean frameAvailable = false; @Override public void onFrameAvailable(SurfaceTexture surfaceTexture) { synchronized (this) { Log.e("---", "onFrameAvailable: "); frameAvailable = true; } } private void drawTexture() { // Draw texture GLES20.glEnableVertexAttribArray(positionHandle); GLES20.glVertexAttribPointer(positionHandle, 2, GLES20.GL_FLOAT, false, 0, vertexBuffer); GLES20.glEnableVertexAttribArray(textureCoordinateHandle); GLES20.glVertexAttribPointer(textureCoordinateHandle, 4, GLES20.GL_FLOAT, false, 0, textureBuffer); GLES20.glUniformMatrix4fv(textureTranformHandle, 1, false, videoTextureTransform, 0); GLES20.glDrawElements(GLES20.GL_TRIANGLES, drawOrder.length, GLES20.GL_UNSIGNED_SHORT, drawListBuffer); } } fragment_shader #extension GL_OES_EGL_image_external : require precision mediump float; uniform samplerExternalOES texture; varying vec2 v_TexCoordinate; void main () { vec4 color = texture2D(texture, v_TexCoordinate); gl_FragColor = color; } vetext_shader attribute vec4 vPosition; attribute vec4 vTexCoordinate; uniform mat4 textureTransform; varying vec2 v_TexCoordinate; void main () { v_TexCoordinate = (textureTransform * vTexCoordinate).xy; gl_Position = vPosition; } 视频可以播放,截屏就无法正常显示了,不知道为何求大神指教![图片说明](https://img-ask.csdn.net/upload/201703/07/1488876551_179145.png)
android 使用 opengl 2.0 显示一张静态背景图片,效果显示出来的很奇怪
背景原图是: ![图片说明](https://img-ask.csdn.net/upload/201508/15/1439633444_381670.jpg) 显示的效果却是: ![图片说明](https://img-ask.csdn.net/upload/201508/15/1439633465_796588.png) 我不知道我的代码错在哪了。请有OpenGL开发经验的兄弟帮忙下。我的代码如下: ``` public class BackgroundGLRnder implements GLSurfaceView.Renderer { // Our matrices private final float[] mtrxProjection = new float[16]; private final float[] mtrxView = new float[16]; private final float[] mtrxProjectionAndView = new float[16]; // Geometric variables private float vertices[]; private static float uvs[] = new float[] { 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f }; private static short indices[] = new short[]{ 0, 1, 2, 0, 2, 3}; private FloatBuffer vertexBuffer; private ShortBuffer drawListBuffer; private FloatBuffer uvBuffer; // Our screenresolution private float mScreenWidth = 0; private float mScreenHeight = 0; // Misc private Context mContext; private int mProgramHandle; private int mTextureDataHandle0; /** This will be used to pass in the transformation matrix. */ private int mMVPMatrixHandle; /** This will be used to pass in the texture. */ private int mTextureUniformHandle0; /** This will be used to pass in model position information. */ private int mPositionHandle; /** This will be used to pass in model color information. */ // private int mColorHandle; /** This will be used to pass in model texture coordinate information. */ private int mTextureCoordinateHandle; public BackgroundGLRnder(Context c) { mContext = c; } @Override public void onSurfaceCreated(GL10 gl, EGLConfig config) { SetupImage(); // Set the clear color to black GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1); final String vertexShader = getVertexShader(); final String fragmentShader = getFragmentShader(); final int vertexShaderHandle = ShaderHelper.compileShader(GLES20.GL_VERTEX_SHADER, vertexShader); final int fragmentShaderHandle = ShaderHelper.compileShader( GLES20.GL_FRAGMENT_SHADER, fragmentShader); mProgramHandle = ShaderHelper.createAndLinkProgram(vertexShaderHandle, fragmentShaderHandle, new String[] { "a_Position", "a_TexCoordinate" }); // Set our per-vertex lighting program. GLES20.glUseProgram(mProgramHandle); } @Override public void onSurfaceChanged(GL10 gl, int width, int height) { mScreenWidth = width; mScreenHeight = height; // Redo the Viewport, making it fullscreen. GLES20.glViewport(0, 0, (int) mScreenWidth, (int) mScreenHeight); // Clear our matrices for(int i=0;i<16;i++) { mtrxProjection[i] = 0.0f; mtrxView[i] = 0.0f; mtrxProjectionAndView[i] = 0.0f; } // Setup our screen width and height for normal sprite translation. Matrix.orthoM(mtrxProjection, 0, 0f, mScreenWidth, 0.0f, mScreenHeight, -1, 1); } @Override public void onDrawFrame(GL10 gl) { // Set program handles for cube drawing. mMVPMatrixHandle = GLES20.glGetUniformLocation(mProgramHandle, "u_MVPMatrix"); mTextureUniformHandle0 = GLES20.glGetUniformLocation(mProgramHandle, "u_Texture"); mPositionHandle = GLES20.glGetAttribLocation(mProgramHandle, "a_Position"); mTextureCoordinateHandle = GLES20.glGetAttribLocation(mProgramHandle, "a_TexCoordinate"); // clear Screen and Depth Buffer, // we have set the clear color as black. GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA); GLES20.glEnableVertexAttribArray(mPositionHandle); GLES20.glEnableVertexAttribArray(mTextureCoordinateHandle); GLES20.glVertexAttribPointer(mPositionHandle, 3, GLES20.GL_FLOAT, false, 0, vertexBuffer); GLES20.glVertexAttribPointer(mTextureCoordinateHandle, 3, GLES20.GL_FLOAT, false, 0, uvBuffer); // Apply the projection and view transformation GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mtrxProjection, 0); /** * First texture map */ // Set the active texture0 unit to texture unit 0. GLES20.glActiveTexture(GLES20.GL_TEXTURE0); // Bind the texture to this unit. GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataHandle0); // Set the sampler texture unit to 0, where we have saved the texture. GLES20.glUniform1i(mTextureUniformHandle0, 0); // Draw the triangle GLES20.glDrawElements(GLES20.GL_TRIANGLES, indices.length, GLES20.GL_UNSIGNED_SHORT, drawListBuffer); // Disable vertex array GLES20.glDisableVertexAttribArray(mPositionHandle); GLES20.glDisableVertexAttribArray(mTextureCoordinateHandle); } private String getVertexShader() { return RawResourceReader.readTextFileFromRawResource(mContext, R.raw ._vertex_shader); } private String getFragmentShader() { return RawResourceReader.readTextFileFromRawResource(mContext, R.raw._fragment_shader); } private void constructVertex(){ float with = getScreenWidth(); float heigh = getScreenHeight(); vertices = new float[]{ 0.0f,0.0f,-1.0f, with,0.0f,-1.0f, with,heigh,-1.0f, 0.0f,heigh,-1.0f }; } public void SetupImage() { constructVertex(); // The vertex buffer. ByteBuffer bb = ByteBuffer.allocateDirect(vertices.length * 4); bb.order(ByteOrder.nativeOrder()); vertexBuffer = bb.asFloatBuffer(); vertexBuffer.put(vertices); vertexBuffer.position(0); // initialize byte buffer for the draw list ByteBuffer dlb = ByteBuffer.allocateDirect(indices.length * 2); dlb.order(ByteOrder.nativeOrder()); drawListBuffer = dlb.asShortBuffer(); drawListBuffer.put(indices); drawListBuffer.position(0); // The texture buffer ByteBuffer uvsbb = ByteBuffer.allocateDirect(uvs.length * 4); uvsbb.order(ByteOrder.nativeOrder()); uvBuffer = uvsbb.asFloatBuffer(); uvBuffer.put(uvs); uvBuffer.position(0); // Load the texture mTextureDataHandle0 = TextureHelper.loadTexture(mContext, R.raw.bg_fine_day); // mTextureDataHandle0 = TextureHelper.loadTexture(mContext.getResources().openRawResource // (R.raw.bg_fine_day));x } private int getScreenWidth() { WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); @SuppressWarnings("deprecation") int width = wm.getDefaultDisplay().getWidth();// 屏幕宽度 return width; } private int getScreenHeight() { WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); @SuppressWarnings("deprecation") int height = wm.getDefaultDisplay().getHeight();// 屏幕高度 return height; } ```
为什么代码中的GLES20会显示错误
package com.bn.Sample9_1; import android.opengl.GLSurfaceView; import android.opengl.GLES20; import android.view.MotionEvent; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; import android.content.Context; class MySurfaceView extends GLSurfaceView { private final float TOUCH_SCALE_FACTOR = 180.0f/320;//角度缩放比例 private SceneRenderer mRenderer;//场景渲染器 private float mPreviousY;//上次的触控位置Y坐标 private float mPreviousX;//上次的触控位置X坐标 public MySurfaceView(Context context) { super(context); this.setEGLContextClientVersion(2); //设置使用OPENGL ES2.0 mRenderer = new SceneRenderer(); //创建场景渲染器 setRenderer(mRenderer); //设置渲染器 setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);//设置渲染模式为主动渲染 } //触摸事件回调方法 @Override public boolean onTouchEvent(MotionEvent e) { float y = e.getY(); float x = e.getX(); switch (e.getAction()) { case MotionEvent.ACTION_MOVE: float dy = y - mPreviousY;//计算触控笔Y位移 float dx = x - mPreviousX;//计算触控笔X位移 mRenderer.yAngle += dx * TOUCH_SCALE_FACTOR;//设置绕y轴旋转角度 mRenderer.xAngle+= dy * TOUCH_SCALE_FACTOR;//设置绕x轴旋转角度 requestRender();//重绘画面 } mPreviousY = y;//记录触控笔位置 mPreviousX = x;//记录触控笔位置 return true; } private class SceneRenderer implements GLSurfaceView.Renderer { float yAngle;//绕Y轴旋转的角度 float xAngle; //绕X轴旋转的角度 //从指定的obj文件中加载对象 LoadedObjectVertexOnly lovo; public void onDrawFrame(GL10 gl) { //清除深度缓冲与颜色缓冲 GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT); //坐标系推远 MatrixState.pushMatrix(); MatrixState.translate(0, -2f, -25f); //ch.obj //绕Y轴、Z轴旋转 MatrixState.rotate(yAngle, 0, 1, 0); MatrixState.rotate(xAngle, 1, 0, 0); //若加载的物体不为空则绘制物体 if(lovo!=null) { lovo.drawSelf(); } MatrixState.popMatrix(); } public void onSurfaceChanged(GL10 gl, int width, int height) { //设置视窗大小及位置 GLES20.glViewport(0, 0, width, height); //计算GLSurfaceView的宽高比 float ratio = (float) width / height; //调用此方法计算产生透视投影矩阵 MatrixState.setProjectFrustum(-ratio, ratio, -1, 1, 2, 100); //调用此方法产生摄像机9参数位置矩阵 MatrixState.setCamera(0,0,0,0f,0f,-1f,0f,1.0f,0.0f); } public void onSurfaceCreated(GL10 gl, EGLConfig config) { //设置屏幕背景色RGBA GLES20.glClearColor(0.0f,0.0f,0.0f,1.0f); //打开深度检测 GLES20.glEnable(GLES20.GL_DEPTH_TEST); //打开背面剪裁 GLES20.glEnable(GLES20.GL_CULL_FACE); //初始化变换矩阵 MatrixState.setInitStack(); //加载要绘制的物体 lovo=LoadUtil.loadFromFile("ch.obj", MySurfaceView.this.getResources(),MySurfaceView.this); } } }
Android的GLES20RecordingCanvas空指针的问题
错误是友盟统计提供的,只有这些,没法确定是哪段代码出了问题,所以只想问问大家有没有碰到过类似的问题,给我点提示就好啦,谢谢! 目前看都是出现在4.0以上的版本上,应该跟硬件加速有关。但不知道该怎么解决这个问题。不可能全局关闭硬件加速,代价太高 ``` java.lang.NullPointerException at android.view.GLES20RecordingCanvas.drawBitmap(GLES20RecordingCanvas.java:118) at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:393) at android.widget.ImageView.onDraw(ImageView.java:892) at android.view.View.draw(View.java:11015) at android.view.ViewGroup.drawChild(ViewGroup.java:2971) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2573) at android.view.ViewGroup.drawChild(ViewGroup.java:2969) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2573) at android.view.View.draw(View.java:11018) at android.widget.FrameLayout.draw(FrameLayout.java:450) at android.widget.ScrollView.draw(ScrollView.java:1525) at android.view.ViewGroup.drawChild(ViewGroup.java:2971) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2573) at android.view.ViewGroup.drawChild(ViewGroup.java:2969) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2573) at android.view.View.draw(View.java:11018) at android.support.v4.view.ViewPager.draw(ViewPager.java:2092) at android.view.ViewGroup.drawChild(ViewGroup.java:2971) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2573) at android.view.View.getDisplayList(View.java:10452) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2681) at android.view.View.getDisplayList(View.java:10417) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2681) at android.view.View.getDisplayList(View.java:10417) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2681) at android.view.View.getDisplayList(View.java:10417) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2681) at android.view.View.getDisplayList(View.java:10417) at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:851) at android.view.ViewRootImpl.draw(ViewRootImpl.java:2034) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1748) at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2583) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4503) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576) at dalvik.system.NativeStart.main(Native Method) ```
安卓7.1上原生的Launcher2运行报错
我用安卓7.1代码里的Launcher2替代原来的Launcher后,开机无法启动桌面,强制停止,大神们帮忙看看是什么问题,感激不尽 01-01 00:02:31.297 E/AndroidRuntime( 7262): Process: com.android.launcher, PID: 7262 01-01 00:02:31.297 E/AndroidRuntime( 7262): DeadSystemException: The system died; earlier logs will point to the root cause 01-01 00:02:31.299 W/ActivityManager( 4362): Process com.android.launcher has crashed too many times: killing! 01-01 00:02:31.299 W/ActivityManager( 4362): Force finishing activity com.android.launcher/com.android.launcher2.Launcher 01-01 00:02:31.304 I/ActivityManager( 4362): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000100 cmp=com.android.launcher/com.android.launcher2.Launcher} from uid 0 on display 0 01-01 00:02:31.306 W/WindowManager( 4362): Failed looking up window 01-01 00:02:31.306 W/WindowManager( 4362): java.lang.IllegalArgumentException: Requested window android.view.ViewRootImpl$W@8d24662 does not exist 01-01 00:02:31.306 W/WindowManager( 4362): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:9415) 01-01 00:02:31.306 W/WindowManager( 4362): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:9406) 01-01 00:02:31.306 W/WindowManager( 4362): at com.android.server.wm.WindowManagerService.removeWindow(WindowManagerService.java:2387) 01-01 00:02:31.306 W/WindowManager( 4362): at com.android.server.wm.Session.remove(Session.java:193) 01-01 00:02:31.306 W/WindowManager( 4362): at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:3290) 01-01 00:02:31.306 W/WindowManager( 4362): at android.view.ViewRootImpl.doDie(ViewRootImpl.java:5917) 01-01 00:02:31.306 W/WindowManager( 4362): at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3626) 01-01 00:02:31.306 W/WindowManager( 4362): at android.os.Handler.dispatchMessage(Handler.java:102) 01-01 00:02:31.306 W/WindowManager( 4362): at android.os.Looper.loop(Looper.java:154) 01-01 00:02:31.306 W/WindowManager( 4362): at android.os.HandlerThread.run(HandlerThread.java:61) 01-01 00:02:31.306 W/WindowManager( 4362): at com.android.server.ServiceThread.run(ServiceThread.java:46) 01-01 00:02:31.309 I/ActivityManager( 4362): Killing 7262:com.android.launcher/1000 (adj 0): crash 01-01 00:02:31.309 D/ActivityManager( 4362): cleanUpApplicationRecord -- 7262 01-01 00:02:31.310 I/libprocessgroup( 4362): Killing pid 7281 in uid 1000 as part of process group 7262 01-01 00:02:31.325 I/ActivityManager( 4362): Start proc 7284:com.android.launcher/1000 for activity com.android.launcher/com.android.launcher2.Launcher 01-01 00:02:31.353 W/System ( 7284): ClassLoader referenced unknown path: /system/priv-app/Launcher2/lib/arm64 01-01 00:02:31.357 W/art ( 7284): JIT profile information will not be recorded: profile file does not exits. 01-01 00:02:31.366 W/ContextImpl( 7284): Failed to ensure /data/user_de/0/com.android.launcher/code_cache: mkdir failed: EACCES (Permission denied) 01-01 00:02:31.386 D/FrameBuffer( 4029): GLES, req offset: 1080 01-01 00:02:31.539 W/WallpaperManager( 7284): WallpaperService not running 01-01 00:02:31.539 E/AndroidRuntime( 7284): FATAL EXCEPTION: setWallpaperDimension 01-01 00:02:31.539 E/AndroidRuntime( 7284): Process: com.android.launcher, PID: 7284 01-01 00:02:31.539 E/AndroidRuntime( 7284): DeadSystemException: The system died; earlier logs will point to the root cause 01-01 00:02:31.541 W/ActivityManager( 4362): Force finishing activity com.android.launcher/com.android.launcher2.Launcher
安卓7.1的原生Launcher2无法运行
我最近用安卓7.1代码里的Launcher2取代原来的Launcher后,开机报错,launcher强制停止, 大神们帮忙看看是什么问题,感激不尽.. 01-01 00:02:31.297 E/AndroidRuntime( 7262): FATAL EXCEPTION: setWallpaperDimension 01-01 00:02:31.297 E/AndroidRuntime( 7262): Process: com.android.launcher, PID: 7262 01-01 00:02:31.297 E/AndroidRuntime( 7262): DeadSystemException: The system died; earlier logs will point to the root cause 01-01 00:02:31.299 W/ActivityManager( 4362): Process com.android.launcher has crashed too many times: killing! 01-01 00:02:31.299 W/ActivityManager( 4362): Force finishing activity com.android.launcher/com.android.launcher2.Launcher 01-01 00:02:31.304 I/ActivityManager( 4362): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000100 cmp=com.android.launcher/com.android.launcher2.Launcher} from uid 0 on display 0 01-01 00:02:31.306 W/WindowManager( 4362): Failed looking up window 01-01 00:02:31.306 W/WindowManager( 4362): java.lang.IllegalArgumentException: Requested window android.view.ViewRootImpl$W@8d24662 does not exist 01-01 00:02:31.306 W/WindowManager( 4362): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:9415) 01-01 00:02:31.306 W/WindowManager( 4362): at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:9406) 01-01 00:02:31.306 W/WindowManager( 4362): at com.android.server.wm.WindowManagerService.removeWindow(WindowManagerService.java:2387) 01-01 00:02:31.306 W/WindowManager( 4362): at com.android.server.wm.Session.remove(Session.java:193) 01-01 00:02:31.306 W/WindowManager( 4362): at android.view.ViewRootImpl.dispatchDetachedFromWindow(ViewRootImpl.java:3290) 01-01 00:02:31.306 W/WindowManager( 4362): at android.view.ViewRootImpl.doDie(ViewRootImpl.java:5917) 01-01 00:02:31.306 W/WindowManager( 4362): at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3626) 01-01 00:02:31.306 W/WindowManager( 4362): at android.os.Handler.dispatchMessage(Handler.java:102) 01-01 00:02:31.306 W/WindowManager( 4362): at android.os.Looper.loop(Looper.java:154) 01-01 00:02:31.306 W/WindowManager( 4362): at android.os.HandlerThread.run(HandlerThread.java:61) 01-01 00:02:31.306 W/WindowManager( 4362): at com.android.server.ServiceThread.run(ServiceThread.java:46) 01-01 00:02:31.309 I/ActivityManager( 4362): Killing 7262:com.android.launcher/1000 (adj 0): crash 01-01 00:02:31.309 D/ActivityManager( 4362): cleanUpApplicationRecord -- 7262 01-01 00:02:31.310 I/libprocessgroup( 4362): Killing pid 7281 in uid 1000 as part of process group 7262 01-01 00:02:31.325 I/ActivityManager( 4362): Start proc 7284:com.android.launcher/1000 for activity com.android.launcher/com.android.launcher2.Launcher 01-01 00:02:31.353 W/System ( 7284): ClassLoader referenced unknown path: /system/priv-app/Launcher2/lib/arm64 01-01 00:02:31.357 W/art ( 7284): JIT profile information will not be recorded: profile file does not exits. 01-01 00:02:31.366 W/ContextImpl( 7284): Failed to ensure /data/user_de/0/com.android.launcher/code_cache: mkdir failed: EACCES (Permission denied) 01-01 00:02:31.386 D/FrameBuffer( 4029): GLES, req offset: 1080 01-01 00:02:31.539 W/WallpaperManager( 7284): WallpaperService not running 01-01 00:02:31.539 E/AndroidRuntime( 7284): FATAL EXCEPTION: setWallpaperDimension 01-01 00:02:31.539 E/AndroidRuntime( 7284): Process: com.android.launcher, PID: 7284 01-01 00:02:31.539 E/AndroidRuntime( 7284): DeadSystemException: The system died; earlier logs will point to the root cause 01-01 00:02:31.541 W/ActivityManager( 4362): Force finishing activity com.android.launcher/com.android.launcher2.Launcher
谁遇到过腾讯Bugly统计的这种bug
1、 # main(1) SIGSEGV(SEGV_MAPERR) 解析原始 1 #00 pc 00002d28 /system/lib/libPowerStretch.so (LucidConfig::calcTargetFPS(int)+27) [armeabi-v7a] 2 #01 pc 41863584 <unknown> 3 java: 4 com.google.android.gles_jni.EGLImpl.eglReleaseThread(Native Method) 5 android.view.HardwareRenderer$Gl20Renderer$Gl20RendererEglContext.onTerminate(HardwareRenderer.java:1743) 6 android.opengl.ManagedEGLContext.execTerminate(ManagedEGLContext.java:84) 7 android.opengl.ManagedEGLContext.doTerminate(ManagedEGLContext.java:132) 8 android.view.WindowManagerGlobal.endTrimMemory(WindowManagerGlobal.java:460) 9 android.app.ActivityThread.handleTrimMemory(ActivityThread.java:4374) 10 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1531) 11 android.os.Handler.dispatchMessage(Handler.java:99) 12 android.os.Looper.loop(Looper.java:137) 13 android.app.ActivityThread.main(ActivityThread.java:5450) 14 java.lang.reflect.Method.invokeNative(Native Method) 15 java.lang.reflect.Method.invoke(Method.java:525) 16 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187) 17 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 18 dalvik.system.NativeStart.main(Native Method) 2、 # main(1) SIGSEGV(SEGV_MAPERR) 解析原始 1 #00 pc 0002975c /system/lib/libdvm.so (javaLangString_length(unsigned int, unsigned int, unsigned int, unsigned int, JValue*)+12) [armeabi-v7a] 2 #01 pc 000228a4 /system/lib/libdvm.so [armeabi-v7a] 3 #02 pc 6d5a02f4 <unknown> 4 java: 5 java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:142) 6 java.lang.StringBuilder.append(StringBuilder.java:216) 7 android.net.NetworkInfo.toString(NetworkInfo.java:444) 8 java.lang.StringBuilder.append(StringBuilder.java:202) 9 com.igexin.push.core.n.a(Unknown Source) 10 com.igexin.push.core.n.onReceive(Unknown Source) 11 android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:794) 12 android.os.Handler.handleCallback(Handler.java:733) 13 android.os.Handler.dispatchMessage(Handler.java:95) 14 android.os.Looper.loop(Looper.java:136) 15 android.app.ActivityThread.main(ActivityThread.java:5314) 16 java.lang.reflect.Method.invokeNative(Native Method) 17 java.lang.reflect.Method.invoke(Method.java:515) 18 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864) 19 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680) 20 dalvik.system.NativeStart.main(Native Method)
安卓开发JDBC连接数据库No static method metafactory错误怎么解决?
直接上代码 JdbcUtil类 ``` package com.example.myapplication; import java.io.File; import java.io.FileInputStream; import java.sql.Connection; import java.sql.DriverManager; import java.util.Properties; public class JdbcUtil { private static JdbcUtil instance; public static JdbcUtil getInstance(){ if (instance ==null){ instance = new JdbcUtil(); } return instance; } public Connection getConnection(String dbName,String name,String password) { try { new com.mysql.cj.jdbc.Driver(); String url = "jdbc:mysql://localhost:3306/"+dbName; return DriverManager.getConnection(url,name,password); } catch (Exception e) { return null; } } public Connection getConnection(String file){ File f = new File(file); if(!f.exists()){ return null; }else { Properties pro = new Properties(); try { Class.forName("com.mysql.jdbc.Driver"); pro.load(new FileInputStream(f)); String url = pro.getProperty("url"); String name = pro.getProperty("name"); String password = pro.getProperty("password"); return DriverManager.getConnection(url,name,password); }catch (Exception e){ return null; } } } } ``` UserDao类 ``` package com.example.myapplication; import android.util.Log; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import static android.content.ContentValues.TAG; public class UserDao { JdbcUtil jdbcUtil = JdbcUtil.getInstance(); //第一个参数为数据库名称,第二个参数为数据库账号 第三个参数为数据库密码 Connection conn = jdbcUtil.getConnection("test","root","LHMbdbqandr2015"); //注册 public boolean register(String name,String password){ if (conn==null){ Log.i(TAG,"register:conn is null"); return false; }else { //进行数据库操作 String sql = "insert into user(name,password) values(?,?)"; try { PreparedStatement pre = conn.prepareStatement(sql); pre.setString(1,name); pre.setString(2,password); return pre.execute(); } catch (SQLException e) { return false; }finally { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } } } //登录 public boolean login(String name,String password){ if (conn==null){ Log.i(TAG,"register:conn is null"); return false; }else { String sql = "select * from user where name=? and password=?"; try { PreparedStatement pres = conn.prepareStatement(sql); pres.setString(1,name); pres.setString(2,password); ResultSet res = pres.executeQuery(); boolean t = res.next(); return t; } catch (SQLException e) { return false; } } } } ``` MainActivity文件 ``` package com.example.myapplication; import android.Manifest; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.os.Looper; import android.os.Trace; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; public class MainActivity extends AppCompatActivity { private static final String TAG="MainActivity"; private EditText name; private EditText password; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); name = findViewById(R.id.name); password = findViewById(R.id.password); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (checkSelfPermission(Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED) { // TODO: Consider calling // Activity#requestPermissions requestPermissions(new String[]{Manifest.permission.INTERNET},1); // here to request the missing permissions, and then overriding // public void onRequestPermissionsResult(int requestCode, String[] permissions, // int[] grantResults) // to handle the case where the user grants the permission. See the documentation // for Activity#requestPermissions for more details. return; } } } //用户根据点击事件来找到相应的功能 public void fun(View v){ switch (v.getId()){ case R.id.register: new Thread(new Runnable() { @Override public void run() { String n = name.getText().toString().trim(); String psw = password.getText().toString().trim(); UserDao ud = new UserDao(); boolean result =ud.register(n,psw); if (!result){ Looper.prepare(); Toast toast = Toast.makeText(MainActivity.this,"注册成功!",Toast.LENGTH_SHORT); toast.show(); Looper.loop(); } Log.i(TAG,"fun"+result); //以上为jdbc注册 } }).start(); break; case R.id.login: new Thread(new Runnable() { @Override public void run() { String n = name.getText().toString().trim(); String psw = password.getText().toString().trim(); if (n.equals("")||psw.equals("")){ Looper.prepare(); Toast toast = Toast.makeText(MainActivity.this,"输入不能为空!",Toast.LENGTH_SHORT); toast.show(); Looper.loop(); } UserDao ud = new UserDao(); Boolean result = ud.login(n,psw); if (!result){ Looper.prepare(); Toast toast=Toast.makeText(MainActivity.this,"用户名不存在或密码错误!",Toast.LENGTH_SHORT); toast.show(); Looper.loop(); }else{ Looper.prepare(); Toast toast=Toast.makeText(MainActivity.this,"登录成功",Toast.LENGTH_SHORT); toast.show(); //一下代码为跳转界面 // Intent intent=new Intent(MainActivity.this,info.class); //intent.putExtra("name",n); // startActivity(intent); Looper.loop(); } //以上为jdbc登录 } }).start(); } } } ``` 现在遇到的问题如下 ``` 11/14 01:40:49: Launching 'app' on Nexus 5X API 29 x86. $ adb shell am start -n "com.example.myapplication/com.example.myapplication.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Waiting for process to come online... Connected to process 23852 on device 'emulator-5554'. Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page. I/e.myapplicatio: Not late-enabling -Xcheck:jni (already on) E/e.myapplicatio: Unknown bits set in runtime_flags: 0x8000 W/e.myapplicatio: Unexpected CPU variant for X86 using defaults: x86 D/libEGL: Emulator has host GPU support, qemu.gles is set to 1. W/libc: Unable to set property "qemu.gles" to "1": connection failed; errno=13 (Permission denied) W/RenderThread: type=1400 audit(0.0:129): avc: denied { write } for name="property_service" dev="tmpfs" ino=8368 scontext=u:r:untrusted_app:s0:c130,c256,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0 app=com.example.myapplication D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so W/e.myapplicatio: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed) Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed) D/: HostConnection::get() New Host Connection established 0xd7d24f50, tid 23910 D/: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_1 W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without... D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0 D/EGL_emulation: eglCreateContext: 0xe3340b60: maj 3 min 1 rcv 4 D/EGL_emulation: eglMakeCurrent: 0xe3340b60: ver 3 1 (tinfo 0xe338bc10) E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da glUtilsParamSize: unknow param 0x000082da W/Gralloc3: mapper 3.x is not supported D/: createUnique: call D/: HostConnection::get() New Host Connection established 0xd7d26ad0, tid 23910 HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_1 D/eglCodecCommon: allocate: Ask for block of size 0x1000 D/eglCodecCommon: allocate: ioctl allocate returned offset 0x3ffff6000 size 0x2000 D/EGL_emulation: eglMakeCurrent: 0xe3340b60: ver 3 1 (tinfo 0xe338bc10) D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0 I/AssistStructure: Flattened final assist data: 1788 bytes, containing 1 windows, 10 views W/e.myapplicatio: Accessing hidden method Ljava/lang/invoke/LambdaMetafactory;->metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; (blacklist, linking, denied) E/AndroidRuntime: FATAL EXCEPTION: Thread-2 Process: com.example.myapplication, PID: 23852 java.lang.NoSuchMethodError: No static method metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; in class Ljava/lang/invoke/LambdaMetafactory; or its super classes (declaration of 'java.lang.invoke.LambdaMetafactory' appears in /apex/com.android.runtime/javalib/core-oj.jar) at com.mysql.cj.conf.ConnectionUrl.buildConnectionStringCacheKey(ConnectionUrl.java:246) at com.mysql.cj.conf.ConnectionUrl.getConnectionUrlInstance(ConnectionUrl.java:185) at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:204) at java.sql.DriverManager.getConnection(DriverManager.java:580) at java.sql.DriverManager.getConnection(DriverManager.java:218) at com.example.myapplication.JdbcUtil.getConnection(JdbcUtil.java:22) at com.example.myapplication.UserDao.<init>(UserDao.java:15) at com.example.myapplication.MainActivity$1.run(MainActivity.java:53) at java.lang.Thread.run(Thread.java:919) D/EGL_emulation: eglMakeCurrent: 0xe3340b60: ver 3 1 (tinfo 0xe338bc10) D/AutofillManager: onActivityFinishing(): calling cancelLocked() Process 23852 terminated. ``` 在网上百度了很多方法都没有解决,起初以为是驱动的问题,但是换了一个仍然不好用,求求大神赐教
Android的LinerLayout动态添加(addView)布局文件,不起效果??
package tech.together.Character.Components; import android.content.Context; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.LinearLayout; import java.util.List; import tech.together.R; /** * Created by think on 2016/6/5. */ public class BecomeEmployeeSkills extends LinearLayout implements View.OnClickListener { private LinearLayout skills; //private LayoutParams param = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); private LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); private List<EditSkillsView> editSkillsViews; public BecomeEmployeeSkills(Context context) { super(context); initView(context); } public BecomeEmployeeSkills(Context context, AttributeSet attrs) { super(context, attrs); initView(context); } private void initView(Context context) { View.inflate(context, R.layout.layout_become_employee_skills, this); findViewById(R.id.add).setOnClickListener(this); findViewById(R.id.submit).setOnClickListener(this); skills = (LinearLayout) findViewById(R.id.skills); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.add: //TODO 使用EditSkillView Log.d("URL", "onClick()ADD"); View view2 = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.view_edit_skill, skills, false); view2.setLayoutParams(param); skills.addView(view2); invalidate(); skills.requestLayout(); break; case R.id.submit: //TODO break; } } } addView后用手机测试,点击按钮没有反应,也不报错,然后输出的是下面的log 06-07 09:47:39.350 8325-8325/tech.together D/URL: onClick()ADD 06-07 09:47:39.366 8325-8325/tech.together D/ColorDrawable: Color = -1118482, canvas = android.view.GLES20RecordingCanvas@2d50567e, mTintMode = SRC_IN, mTint = null, ColorDrawable = android.graphics.drawable.ColorDrawable@3e3c5c62 06-07 09:47:39.544 8325-8325/tech.together V/SettingsInterface: from settings cache , name = sound_effects_enabled , value = 0 0 真不知道是为什么原因,求解释!
notification无法显示
按照第一行代码打的notification,不知道那里错了(水平太低),系统是ubuntu ``` package com.example.unit_8; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.NotificationCompat; import android.app.Notification; import android.app.NotificationManager; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class MainActivity extends AppCompatActivity implements View.OnClickListener{ private Button Send_notice; private NotificationManager notificationManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Send_notice = (Button) findViewById(R.id.send_notice); Send_notice.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()){ case R.id.send_notice: notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Notification notification = new NotificationCompat.Builder(this,"default") .setContentTitle("this is title") .setContentText("this is text") .setSmallIcon(R.mipmap.ic_launcher).build(); notificationManager.notify(1,notification); Log.i("msg","R.id.send_notice"); break; default: break; } } } ``` ``` ``` ``` 这个是log信息 2019-10-13 17:07:18.253 28995-28995/? I/.example.unit_: Not late-enabling -Xcheck:jni (already on) 2019-10-13 17:07:18.283 28995-28995/? E/.example.unit_: Unknown bits set in runtime_flags: 0x8000 2019-10-13 17:07:18.288 28995-28995/? W/.example.unit_: Unexpected CPU variant for X86 using defaults: x86 2019-10-13 17:07:18.497 28995-28995/com.example.unit_8 W/.example.unit_: JIT profile information will not be recorded: profile file does not exits. 2019-10-13 17:07:18.498 28995-28995/com.example.unit_8 I/chatty: uid=10142(com.example.unit_8) identical 10 lines 2019-10-13 17:07:18.498 28995-28995/com.example.unit_8 W/.example.unit_: JIT profile information will not be recorded: profile file does not exits. 2019-10-13 17:07:18.504 28995-28995/com.example.unit_8 I/InstantRun: starting instant run server: is main process 2019-10-13 17:07:18.523 28995-28995/com.example.unit_8 W/RenderThread: type=1400 audit(0.0:186): avc: denied { write } for name="property_service" dev="tmpfs" ino=7189 scontext=u:r:untrusted_app:s0:c142,c256,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0 2019-10-13 17:07:18.540 28995-29016/com.example.unit_8 D/libEGL: Emulator has host GPU support, qemu.gles is set to 1. 2019-10-13 17:07:18.541 28995-29016/com.example.unit_8 W/libc: Unable to set property "qemu.gles" to "1": connection failed; errno=13 (Permission denied) 2019-10-13 17:07:18.603 28995-29016/com.example.unit_8 D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so 2019-10-13 17:07:18.604 28995-29016/com.example.unit_8 D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so 2019-10-13 17:07:18.617 28995-29016/com.example.unit_8 D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so 2019-10-13 17:07:18.695 28995-28995/com.example.unit_8 W/.example.unit_: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed) 2019-10-13 17:07:18.695 28995-28995/com.example.unit_8 W/.example.unit_: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed) 2019-10-13 17:07:18.849 28995-29014/com.example.unit_8 D/HostConnection: HostConnection::get() New Host Connection established 0xd753b9a0, tid 29014 2019-10-13 17:07:18.855 28995-29014/com.example.unit_8 D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2 2019-10-13 17:07:18.874 28995-29014/com.example.unit_8 W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without... 2019-10-13 17:07:18.876 28995-29014/com.example.unit_8 D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0 2019-10-13 17:07:18.876 28995-29014/com.example.unit_8 D/EGL_emulation: eglCreateContext: 0xe2c1c180: maj 2 min 0 rcv 2 2019-10-13 17:07:18.877 28995-29014/com.example.unit_8 D/EGL_emulation: eglMakeCurrent: 0xe2c1c180: ver 2 0 (tinfo 0xe2cfded0) 2019-10-13 17:07:18.942 28995-29014/com.example.unit_8 W/Gralloc3: mapper 3.x is not supported 2019-10-13 17:07:18.948 28995-29014/com.example.unit_8 D/HostConnection: createUnique: call 2019-10-13 17:07:18.950 28995-29014/com.example.unit_8 D/HostConnection: HostConnection::get() New Host Connection established 0xd753d110, tid 29014 2019-10-13 17:07:18.969 28995-29014/com.example.unit_8 D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2 2019-10-13 17:07:18.969 28995-29014/com.example.unit_8 D/eglCodecCommon: allocate: Ask for block of size 0x1000 2019-10-13 17:07:18.969 28995-29014/com.example.unit_8 D/eglCodecCommon: allocate: ioctl allocate returned offset 0x3ff801000 size 0x2000 2019-10-13 17:07:19.005 28995-29014/com.example.unit_8 D/EGL_emulation: eglMakeCurrent: 0xe2c1c180: ver 2 0 (tinfo 0xe2cfded0) 2019-10-13 17:07:19.012 28995-29014/com.example.unit_8 D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 0 2019-10-13 17:07:34.632 28995-28995/com.example.unit_8 I/msg: R.id.send_notice
监听网络变化的程序,Toast功能出不来,报错也不知道怎么拯救这个错误
package com.example.broadcasttest; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.NetworkOnMainThreadException; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.Toast; public class MainActivity extends AppCompatActivity { private IntentFilter intentFilter; private NetworkChangeReceiver networkChangeReceiver; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); intentFilter = new IntentFilter(); intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE"); networkChangeReceiver = new NetworkChangeReceiver(); registerReceiver(networkChangeReceiver, intentFilter); } @Override protected void onDestroy() { super.onDestroy(); unregisterReceiver(networkChangeReceiver); } class NetworkChangeReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { ConnectivityManager connectionManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connectionManager.getActiveNetworkInfo(); if (networkInfo != null && networkInfo.isAvailable()) { Toast.makeText(context, "network is available", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(context, "network is unavailable", Toast.LENGTH_SHORT).show(); } } } } AndroidManifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.broadcasttest"> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <application 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"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> 报错 02-26 02:59:02.161 1590-1590/? I/art: Late-enabling -Xcheck:jni 02-26 02:59:02.162 1590-1590/? W/art: Unexpected CPU variant for X86 using defaults: x86 02-26 02:59:02.705 1590-1590/com.example.broadcasttest W/System: ClassLoader referenced unknown path: /data/app/com.example.broadcasttest-1/lib/x86 02-26 02:59:02.983 1590-1590/com.example.broadcasttest W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable [ 02-26 02:59:03.293 1590: 1590 D/ ] HostConnection::get() New Host Connection established 0xe5cf49c0, tid 1590 [ 02-26 02:59:03.451 1590: 1590 W/ ] Process pipe failed 02-26 02:59:03.573 1590-1605/com.example.broadcasttest D/libEGL: Emulator has host GPU support, qemu.gles is set to 1. 02-26 02:59:03.575 1590-1605/com.example.broadcasttest E/libEGL: load_driver(/system/lib/egl/libGLES_emulation.so): dlopen failed: library "/system/lib/egl/libGLES_emulation.so" not found 02-26 02:59:03.579 1590-1605/com.example.broadcasttest D/libEGL: loaded /system/lib/egl/libEGL_emulation.so 02-26 02:59:03.582 1590-1605/com.example.broadcasttest D/libEGL: loaded /system/lib/egl/libGLESv1_CM_emulation.so 02-26 02:59:03.613 1590-1605/com.example.broadcasttest D/libEGL: loaded /system/lib/egl/libGLESv2_emulation.so 02-26 02:59:03.818 1590-1605/com.example.broadcasttest I/OpenGLRenderer: Initialized EGL, version 1.4 02-26 02:59:03.818 1590-1605/com.example.broadcasttest D/OpenGLRenderer: Swap behavior 1 02-26 02:59:04.294 1590-1605/com.example.broadcasttest E/EGL_emulation: tid 1605: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH) 02-26 02:59:04.294 1590-1605/com.example.broadcasttest W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xcc924180, error=EGL_BAD_MATCH 02-26 02:59:04.309 1590-1590/com.example.broadcasttest I/Choreographer: Skipped 32 frames! The application may be doing too much work on its main thread. 02-26 02:59:05.625 1590-1605/com.example.broadcasttest E/EGL_emulation: tid 1605: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH) 02-26 02:59:05.625 1590-1605/com.example.broadcasttest W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xcc924400, error=EGL_BAD_MATCH
小白求问为什么应用一进去就闪退了
04-17 22:29:38.316 2512-2512/? I/appproc: denglibo exec app_process! cmdline: /system/bin com.android.commands.pm.Pm install -t -r /data/local/tmp/com.example.hasee.myapplication 04-17 22:29:38.316 2512-2512/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<< 04-17 22:29:38.317 2512-2512/? D/AndroidRuntime: CheckJNI is OFF 04-17 22:29:38.332 2512-2512/? D/libnativebridge: PreInitializeNativeBridge name=unknown 04-17 22:29:38.359 2512-2512/? E/memtrack: Couldn't load memtrack module (No such file or directory) 04-17 22:29:38.359 2512-2512/? E/android.os.Debug: failed to load memtrack module: -2 04-17 22:29:38.376 2512-2512/? D/AndroidRuntime: Calling main entry com.android.commands.pm.Pm --------- beginning of system 04-17 22:29:38.382 2159-2174/com.android.defcontainer I/NativeHelper: denglibo call findSupportedAbi! abiList=x86 armeabi-v7a armeabi packageName=com.example.hasee.myapplication 04-17 22:29:38.384 2159-2174/com.android.defcontainer D/NativeLibraryHelper: denglibo call LdFindSupportedAbi, param: supportedAbisArray=x86 armeabi-v7a armeabi 04-17 22:29:38.385 2159-2174/com.android.defcontainer D/NativeLibraryHelper: denglibo native LdFindSupportedAbi return! ret=-114 abi=NULL 04-17 22:29:38.388 2159-2173/com.android.defcontainer D/DefContainer: Copying /data/local/tmp/com.example.hasee.myapplication to base.apk 04-17 22:29:38.393 1541-1570/system_process I/NativeHelper: denglibo call findSupportedAbi! abiList=x86 armeabi-v7a armeabi packageName=com.example.hasee.myapplication 04-17 22:29:38.395 1541-1570/system_process D/NativeLibraryHelper: denglibo call LdFindSupportedAbi, param: supportedAbisArray=x86 armeabi-v7a armeabi 04-17 22:29:38.396 1541-1570/system_process D/NativeLibraryHelper: denglibo native LdFindSupportedAbi return! ret=-114 abi=NULL 04-17 22:29:38.409 1541-1570/system_process D/PackageManager: Renaming /data/app/vmdl270166158.tmp to /data/app/com.example.hasee.myapplication-2 04-17 22:29:38.410 1541-1561/system_process I/ActivityManager: Force stopping com.example.hasee.myapplication appid=10031 user=-1: uninstall pkg 04-17 22:29:38.417 1541-1570/system_process I/PackageManager: denglibo-scanPackageDirtyLI oldSeting(packages.xml): com.example.hasee.myapplication orig primaryCpuAbi: null secondaryCpuAbi: null cpuAbiOverride: null myOrigCpuAbi: null 04-17 22:29:38.417 1541-1570/system_process I/PackageManager: Package com.example.hasee.myapplication codePath changed from /data/app/com.example.hasee.myapplication-1 to /data/app/com.example.hasee.myapplication-2; Retaining data and using new 04-17 22:29:38.424 1541-1570/system_process I/NativeHelper: denglibo call findSupportedAbi! abiList=x86 armeabi-v7a armeabi packageName=com.example.hasee.myapplication 04-17 22:29:38.427 1541-1570/system_process D/NativeLibraryHelper: denglibo call LdFindSupportedAbi, param: supportedAbisArray=x86 armeabi-v7a armeabi 04-17 22:29:38.427 1541-1570/system_process D/NativeLibraryHelper: denglibo native LdFindSupportedAbi return! ret=-114 abi=NULL 04-17 22:29:38.428 1541-1570/system_process I/PackageManager: denglibo-copyNativeBinariesForSupportedAbi finish: copyRet = -114 04-17 22:29:38.428 1541-1570/system_process I/PackageManager: Running dexopt on: /data/app/com.example.hasee.myapplication-2/base.apk pkg=com.example.hasee.myapplication isa=x86 vmSafeMode=false 04-17 22:29:38.437 2523-2523/? I/dex2oat: /system/bin/dex2oat --zip-fd=5 --zip-location=/data/app/com.example.hasee.myapplication-2/base.apk --oat-fd=6 --oat-location=/data/dalvik-cache/x86/data@app@com.example.hasee.myapplication-2@base.apk@classes.dex --instruction-set=x86 --instruction-set-features=default --runtime-arg -Xms64m --runtime-arg -Xmx512m --swap-fd=7 04-17 22:29:38.439 2523-2523/? E/libnativebridge: denglibol LoadNativeBridge error! nb_library_filename invalid! 04-17 22:29:38.517 2523-2523/? I/dex2oat: Decided to run without swap. 04-17 22:29:38.539 2523-2523/? W/dex2oat: Before Android 4.1, method int android.support.v7.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView 04-17 22:29:38.558 2523-2525/? W/dex2oat: Before Android 4.1, method int android.support.v7.widget.MenuPopupWindow$MenuDropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView 04-17 22:29:38.560 2523-2525/? W/dex2oat: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable 04-17 22:29:39.453 2523-2523/? I/dex2oat: dex2oat took 1.015s (threads: 2) arena alloc=306KB java alloc=3MB native alloc=6MB free=9MB 04-17 22:29:39.454 1541-1570/system_process W/PackageManager: Code path for pkg : com.example.hasee.myapplication changing from /data/app/com.example.hasee.myapplication-1 to /data/app/com.example.hasee.myapplication-2 04-17 22:29:39.454 1541-1570/system_process W/PackageManager: Resource path for pkg : com.example.hasee.myapplication changing from /data/app/com.example.hasee.myapplication-1 to /data/app/com.example.hasee.myapplication-2 04-17 22:29:39.455 1541-1561/system_process I/ActivityManager: Force stopping com.example.hasee.myapplication appid=10031 user=-1: update pkg 04-17 22:29:39.464 1541-1570/system_process I/ActivityManager: Force stopping com.example.hasee.myapplication appid=10031 user=0: pkg removed 04-17 22:29:39.471 1752-1752/com.android.launcher3 I/art: Explicit concurrent mark sweep GC freed 1842(105KB) AllocSpace objects, 3(108KB) LOS objects, 39% free, 11MB/19MB, paused 137us total 6.681ms 04-17 22:29:39.473 1994-1994/com.android.flysilkworm I/art: Explicit concurrent mark sweep GC freed 165(6KB) AllocSpace objects, 1(36KB) LOS objects, 24% free, 8MB/11MB, paused 126us total 6.168ms 04-17 22:29:39.478 1644-1644/com.android.systemui I/art: Explicit concurrent mark sweep GC freed 17097(644KB) AllocSpace objects, 0(0B) LOS objects, 39% free, 16MB/27MB, paused 156us total 13.779ms 04-17 22:29:39.485 1541-1587/system_process I/InputReader: Reconfiguring input devices. changes=0x00000010 04-17 22:29:39.486 1541-1587/system_process I/InputReader: Reconfiguring input devices. changes=0x00000010 04-17 22:29:39.487 1714-1714/com.android.emu.coreservice I/EmuCoreService: Broadcast action = android.intent.action.PACKAGE_REMOVED 04-17 22:29:39.491 1541-1570/system_process W/Settings: Setting install_non_market_apps has moved from android.provider.Settings.Global to android.provider.Settings.Secure, returning read-only value. 04-17 22:29:39.491 1541-1587/system_process I/InputReader: Reconfiguring input devices. changes=0x00000010 04-17 22:29:39.492 2093-2093/com.android.keychain W/ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1692 android.content.ContextWrapper.startService:516 android.content.ContextWrapper.startService:516 com.android.keychain.KeyChainBroadcastReceiver.onReceive:12 android.app.ActivityThread.handleReceiver:2609 04-17 22:29:39.493 1752-1752/com.android.launcher3 W/Launcher: setApplicationContext called twice! old=com.android.launcher3.LauncherApplication@22977308 new=com.android.launcher3.LauncherApplication@22977308 04-17 22:29:39.494 1541-1560/system_process W/Searchables: No global search activity found 04-17 22:29:39.503 1541-1541/system_process I/art: Explicit concurrent mark sweep GC freed 83651(4MB) AllocSpace objects, 29(1129KB) LOS objects, 33% free, 15MB/23MB, paused 1.088ms total 29.050ms 04-17 22:29:39.503 1541-1541/system_process D/JobSchedulerService: Receieved: android.intent.action.PACKAGE_REMOVED 04-17 22:29:39.503 1541-1541/system_process D/BackupManagerService: Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.example.hasee.myapplication flg=0x4000010 (has extras) } 04-17 22:29:39.504 1541-1570/system_process I/art: WaitForGcToComplete blocked for 12.932ms for cause Explicit 04-17 22:29:39.512 1994-1994/com.android.flysilkworm I/appstore: app Not Started 04-17 22:29:39.512 1541-1541/system_process D/BackupManagerService: Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.example.hasee.myapplication flg=0x4000010 (has extras) } 04-17 22:29:39.512 1541-1541/system_process W/BackupManagerService: Removing schedule queue dupe of com.example.hasee.myapplication 04-17 22:29:39.513 1541-1560/system_process W/Searchables: No global search activity found 04-17 22:29:39.515 1541-1560/system_process W/VoiceInteractionManagerService: no available voice recognition services found for user 0 04-17 22:29:39.515 1714-1714/com.android.emu.coreservice I/EmuCoreService: Broadcast action = android.intent.action.PACKAGE_ADDED 04-17 22:29:39.527 1541-1753/system_process W/BackupManagerService: dataChanged but no participant pkg='com.android.launcher3' uid=10020 04-17 22:29:39.536 1994-1994/com.android.flysilkworm I/appstore: app Not Started 04-17 22:29:39.539 1752-1752/com.android.launcher3 W/Launcher: setApplicationContext called twice! old=com.android.launcher3.LauncherApplication@22977308 new=com.android.launcher3.LauncherApplication@22977308 04-17 22:29:39.542 1541-1570/system_process I/art: Explicit concurrent mark sweep GC freed 5719(344KB) AllocSpace objects, 0(0B) LOS objects, 33% free, 15MB/23MB, paused 1.145ms total 38.299ms 04-17 22:29:39.546 2512-2512/? I/art: System.exit called, status: 0 04-17 22:29:39.547 2512-2512/? I/AndroidRuntime: VM exiting with result code 0. 04-17 22:29:39.628 1994-2199/com.android.flysilkworm I/System.out: 200 04-17 22:29:39.655 2536-2536/? I/appproc: denglibo exec app_process! cmdline: /system/bin com.android.commands.am.Am start -n com.example.hasee.myapplication/com.example.hasee.myapplication.MainActivity -a android.intent.action.MAIN -c android.intent.category.LAUNCHER 04-17 22:29:39.655 2536-2536/? D/AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<< 04-17 22:29:39.657 2536-2536/? D/AndroidRuntime: CheckJNI is OFF 04-17 22:29:39.667 2536-2536/? D/libnativebridge: PreInitializeNativeBridge name=unknown 04-17 22:29:39.679 2536-2536/? E/memtrack: Couldn't load memtrack module (No such file or directory) 04-17 22:29:39.679 2536-2536/? E/android.os.Debug: failed to load memtrack module: -2 04-17 22:29:39.694 2536-2536/? D/AndroidRuntime: Calling main entry com.android.commands.am.Am 04-17 22:29:39.718 1541-1555/system_process I/ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.hasee.myapplication/.MainActivity} from uid 0 on display 0 04-17 22:29:39.719 1541-1555/system_process V/WindowManager: addAppToken: AppWindowToken{362f7eb7 token=Token{2ac5a1b6 ActivityRecord{18688551 u0 com.example.hasee.myapplication/.MainActivity t7}}} to stack=1 task=7 at 0 04-17 22:29:39.720 1541-1566/system_process V/WindowManager: Adding window Window{3c93318e u0 Starting com.example.hasee.myapplication} at 2 of 5 (after Window{fa9636f u0 com.android.launcher3/com.android.launcher3.Launcher}) 04-17 22:29:39.721 2536-2536/? D/AndroidRuntime: Shutting down VM 04-17 22:29:39.721 2536-2536/? D/libnativebridge: call UnloadNativeBridge! state=1 04-17 22:29:39.730 1541-1555/system_process I/ActivityManager: Start proc 2546:com.example.hasee.myapplication/u0a31 for activity com.example.hasee.myapplication/.MainActivity 04-17 22:29:39.731 1714-1714/com.android.emu.coreservice I/EmuCoreService: Broadcast action = android.intent.action.TOP_ACTIVITY_CHANGED 04-17 22:29:39.748 2546-2546/? I/art: Late-enabling -Xcheck:jni 04-17 22:29:39.748 2546-2546/? D/libnativebridge: call UnloadNativeBridge! state=1 04-17 22:29:39.768 2546-2554/? I/art: Debugger is no longer active 04-17 22:29:39.861 2546-2546/? D/AndroidRuntime: Shutting down VM --------- beginning of crash 04-17 22:29:39.861 2546-2546/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.hasee.myapplication, PID: 2546 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.hasee.myapplication/com.example.hasee.myapplication.MainActivity}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list' at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700) Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list' at android.app.ListActivity.onContentChanged(ListActivity.java:243) at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:382) at android.app.Activity.setContentView(Activity.java:2145) at com.example.hasee.myapplication.MainActivity.onCreate(MainActivity.java:34) at android.app.Activity.performCreate(Activity.java:5990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)  at android.app.ActivityThread.access$800(ActivityThread.java:151)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5254)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)  04-17 22:29:39.861 1541-1708/system_process W/ActivityManager: Force finishing activity 1 com.example.hasee.myapplication/.MainActivity 04-17 22:29:39.951 1752-2049/com.android.launcher3 D/EGL_adreno: eglMakeCurrent: 0xaec34760: ver 3 1 (tinfo 0xaec395f0) 04-17 22:29:40.069 1365-1365/? E/EGL_adreno: tid 1365: eglCreateSyncKHR(1987): error 0x3004 (EGL_BAD_ATTRIBUTE) 04-17 22:29:40.074 1541-1541/system_process W/art: Long monitor contention event with owner method=void com.android.server.am.ActivityManagerService.crashApplication(com.android.server.am.ProcessRecord, android.app.ApplicationErrorReport$CrashInfo) from ActivityManagerService.java:12135 waiters=0 for 211ms 04-17 22:29:40.074 1541-1561/system_process W/System.err: java.lang.Exception: denglibo show AlertDialog! title= 04-17 22:29:40.074 1541-1561/system_process W/System.err: at android.app.AlertDialog.show(AlertDialog.java:112) 04-17 22:29:40.074 1541-1561/system_process W/System.err: at com.android.server.am.ActivityManagerService$MainHandler.handleMessage(ActivityManagerService.java:1342) 04-17 22:29:40.074 1541-1561/system_process W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102) 04-17 22:29:40.074 1541-1561/system_process W/System.err: at android.os.Looper.loop(Looper.java:135) 04-17 22:29:40.074 1541-1561/system_process W/System.err: at android.os.HandlerThread.run(HandlerThread.java:61) 04-17 22:29:40.074 1541-1561/system_process W/System.err: at com.android.server.ServiceThread.run(ServiceThread.java:46) 04-17 22:29:40.106 1541-2235/system_process I/OpenGLRenderer: Initialized EGL, version 1.4 04-17 22:29:40.106 1541-2235/system_process I/EGL_adreno: eglCreateContext request GLES major-version=2 04-17 22:29:40.107 1541-2235/system_process D/EGL_adreno: eglCreateContext: 0x9edfe9a0: maj 3 min 1 rcv 4 04-17 22:29:40.111 1541-2235/system_process D/EGL_adreno: eglMakeCurrent: 0x9edfe9a0: ver 3 1 (tinfo 0xa22f8770) 04-17 22:29:40.118 1541-2235/system_process E/EGL_adreno: tid 2235: eglSurfaceAttrib(1266): error 0x3009 (EGL_BAD_MATCH) 04-17 22:29:40.118 1541-2235/system_process W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xaec22700, error=EGL_BAD_MATCH 04-17 22:29:40.119 1541-2235/system_process D/EGL_adreno: eglMakeCurrent: 0x9edfe9a0: ver 3 1 (tinfo 0xa22f8770) 04-17 22:29:40.574 1541-1561/system_process W/ActivityManager: Activity pause timeout for ActivityRecord{18688551 u0 com.example.hasee.myapplication/.MainActivity t7 f} 04-17 22:29:40.577 1714-1714/com.android.emu.coreservice I/EmuCoreService: Broadcast action = android.intent.action.TOP_ACTIVITY_CHANGED 04-17 22:29:40.593 1752-2049/com.android.launcher3 I/OpenGLRenderer: Initialized EGL, version 1.4 04-17 22:29:40.594 1752-2049/com.android.launcher3 I/EGL_adreno: eglCreateContext request GLES major-version=2 04-17 22:29:40.595 1752-2049/com.android.launcher3 D/EGL_adreno: eglCreateContext: 0xaec34760: maj 3 min 1 rcv 4 04-17 22:29:40.602 1752-2049/com.android.launcher3 D/EGL_adreno: eglMakeCurrent: 0xaec34760: ver 3 1 (tinfo 0xaec395f0) 04-17 22:29:40.615 1752-2049/com.android.launcher3 E/EGL_adreno: tid 2049: eglSurfaceAttrib(1266): error 0x3009 (EGL_BAD_MATCH) 04-17 22:29:40.615 1752-2049/com.android.launcher3 W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xaec601a0, error=EGL_BAD_MATCH 04-17 22:29:40.616 1752-2049/com.android.launcher3 D/EGL_adreno: eglMakeCurrent: 0xaec34760: ver 3 1 (tinfo 0xaec395f0) 04-17 22:29:40.662 1752-2049/com.android.launcher3 V/RenderScript: 0xaedacc00 Launching thread(s), CPUs 2 04-17 22:29:40.798 1541-1595/system_process E/WifiStateMachine: WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=0.00 rxSuccessRate=0.00 targetRoamBSSID=00:81:ec:72:db:e9 RSSI=-45 04-17 22:29:41.146 1752-2049/com.android.launcher3 D/EGL_adreno: eglMakeCurrent: 0xaec34760: ver 3 1 (tinfo 0xaec395f0) 04-17 22:29:41.157 1752-2049/com.android.launcher3 D/EGL_adreno: eglMakeCurrent: 0xaec34760: ver 3 1 (tinfo 0xaec395f0) 04-17 22:29:41.160 1752-2049/com.android.launcher3 D/EGL_adreno: eglMakeCurrent: 0xaec34760: ver 3 1 (tinfo 0xaec395f0) 04-17 22:29:41.160 1752-2049/com.android.launcher3 W/OpenGLRenderer: Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer... 04-17 22:29:41.161 1752-2049/com.android.launcher3 D/EGL_adreno: eglMakeCurrent: 0xaec34760: ver 3 1 (tinfo 0xaec395f0) 04-17 22:29:41.578 1644-1644/com.android.systemui W/ResourceType: No package identifier when getting value for resource number 0x00000000 04-17 22:29:41.578 1644-1644/com.android.systemui W/PackageManager: Failure retrieving resources for com.example.hasee.myapplication: Resource ID #0x0 04-17 22:29:50.691 1541-1561/system_process W/ActivityManager: Activity destroy timeout for ActivityRecord{18688551 u0 com.example.hasee.myapplication/.MainActivity t7 f} 04-17 22:29:59.192 1365-1515/? E/SurfaceFlinger: warning, detect vsync overflow! 04-17 22:30:00.041 1365-1515/? E/SurfaceFlinger: warning, detect vsync overflow! 04-17 22:30:00.801 1541-1595/system_process E/WifiStateMachine: WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=0.00 rxSuccessRate=0.00 targetRoamBSSID=00:81:ec:72:db:e9 RSSI=-45 04-17 22:30:20.806 1541-1595/system_process E/WifiStateMachine: WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=0.00 rxSuccessRate=0.00 targetRoamBSSID=00:81:ec:72:db:e9 RSSI=-45 04-17 22:30:40.811 1541-1595/system_process E/WifiStateMachine: WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=0.00 rxSuccessRate=0.00 targetRoamBSSID=00:81:ec:72:db:e9 RSSI=-45 04-17 22:31:00.816 1541-1595/system_process E/WifiStateMachine: WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=0.00 rxSuccessRate=0.00 targetRoamBSSID=00:81:ec:72:db:e9 RSSI=-45 04-17 22:31:20.817 1541-1595/system_process E/WifiStateMachine: WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=0.00 rxSuccessRate=0.00 targetRoamBSSID=00:81:ec:72:db:e9 RSSI=-45 04-17 22:31:20.920 1541-1595/system_process E/WifiStateMachine: denglibo mScanResults.size=1 04-17 22:31:20.920 1541-1595/system_process I/LdWifi: ld_get_eth0_ip return 172.16.2.15 04-17 22:31:40.821 1541-1595/system_process E/WifiStateMachine: WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=0.00 rxSuccessRate=0.00 targetRoamBSSID=00:81:ec:72:db:e9 RSSI=-45 04-17 22:32:00.824 1541-1595/system_process E/WifiStateMachine: WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=0.00 rxSuccessRate=0.00 targetRoamBSSID=00:81:ec:72:db:e9 RSSI=-45 04-17 22:32:20.827 1541-1595/system_process E/WifiStateMachine: WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=0.00 rxSuccessRate=0.00 targetRoamBSSID=00:81:ec:72:db:e9 RSSI=-45
android studio虚拟机运行出错
刚刚正在运行程序时,电脑突然死机,重启之后虚拟机就开不开机了,出现了如下的报错: ``` restoring GLES1 context from snapshot. App may need reloading. ``` 请问该如何解决。
finsh()杀死进程 第一次无效返回上一次活动 第二次才能杀死
点按Button3,会回到SecondActivity ,再进入thirdActivity 点按button3 才能杀死程序 package com.example.activitytest; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class ThirdActivity extends BaseActivity { @Override protected void onDestroy() { super.onDestroy(); Log.d("ThirdActivity","onDestroy"); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d("ThirdActivity","Task id is " + getTaskId()); setContentView(R.layout.third_layout); Button button3 = (Button) findViewById(R.id.button_3); button3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ActivityCollector.finishAll(); } }); } } package com.example.activitytest; import android.app.Activity; import java.util.ArrayList; import java.util.List; public class ActivityCollector { public static List<Activity> activities = new ArrayList<>(); public static void addActivity(Activity activity) { activities.add(activity); } public static void removeActivity(Activity activity) { activities.remove(activity); } public static void finishAll() { for (Activity activity : activities) { if (!activity.isFinishing()) { activity.finish(); android.os.Process.killProcess(android.os.Process.myPid()); } } activities.clear(); } } 点按button 3 返回Secondactivity时候的logcat 12-26 23:31:29.667 4664-4664/? I/art: Late-enabling -Xcheck:jni 12-26 23:31:29.668 4664-4664/? W/art: Unexpected CPU variant for X86 using defaults: x86 12-26 23:31:30.152 4664-4664/com.example.activitytest W/System: ClassLoader referenced unknown path: /data/app/com.example.activitytest-2/lib/x86 12-26 23:31:30.202 4664-4664/com.example.activitytest I/InstantRun: starting instant run server: is main process 12-26 23:31:30.419 4664-4664/com.example.activitytest W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable 12-26 23:31:30.460 4664-4664/com.example.activitytest D/BaseActivity: SecondActivity 12-26 23:31:30.474 4664-4664/com.example.activitytest D/SecondActivity: Task id is 115 12-26 23:31:31.403 4664-4681/com.example.activitytest D/libEGL: Emulator has host GPU support, qemu.gles is set to 1. 12-26 23:31:31.406 4664-4681/com.example.activitytest E/libEGL: load_driver(/system/lib/egl/libGLES_emulation.so): dlopen failed: library "/system/lib/egl/libGLES_emulation.so" not found 12-26 23:31:31.413 4664-4681/com.example.activitytest D/libEGL: loaded /system/lib/egl/libEGL_emulation.so 12-26 23:31:31.418 4664-4681/com.example.activitytest D/libEGL: loaded /system/lib/egl/libGLESv1_CM_emulation.so 12-26 23:31:31.452 4664-4681/com.example.activitytest D/libEGL: loaded /system/lib/egl/libGLESv2_emulation.so 12-26 23:31:31.534 4664-4681/com.example.activitytest I/OpenGLRenderer: Initialized EGL, version 1.4 12-26 23:31:31.534 4664-4681/com.example.activitytest D/OpenGLRenderer: Swap behavior 1 12-26 23:31:31.584 4664-4664/com.example.activitytest W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView 12-26 23:31:31.713 4664-4681/com.example.activitytest E/EGL_emulation: tid 4681: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH) 12-26 23:31:31.713 4664-4681/com.example.activitytest W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xd73bace0, error=EGL_BAD_MATCH
SDL2 编译报错error: undefined reference to 'openslES_ResumeDevices' 求解决思路
android studio编译SDL2生成.so文件时,报错如下: ``` Build command failed. Error while executing process /Users/ing/sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/Android.mk NDK_APPLICATION_MK=/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/Application.mk APP_ABI=x86_64 NDK_ALL_ABIS=x86_64 NDK_DEBUG=1 APP_PLATFORM=android-16 NDK_OUT=/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/build/intermediates/ndkBuild/debug/lib /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/build/intermediates/ndkBuild/debug/obj/local/x86_64/libSDL2.so} [x86_64] Compile : SDL2 <= SDL.c [x86_64] Compile : SDL2 <= SDL_assert.c [x86_64] Compile : SDL2 <= SDL_dataqueue.c [x86_64] Compile : SDL2 <= SDL_error.c [x86_64] Compile : SDL2 <= SDL_hints.c [x86_64] Compile : SDL2 <= SDL_log.c [x86_64] Compile : SDL2 <= SDL_audio.c [x86_64] Compile : SDL2 <= SDL_audiocvt.c [x86_64] Compile : SDL2 <= SDL_audiodev.c [x86_64] Compile : SDL2 <= SDL_audiotypecvt.c [x86_64] Compile : SDL2 <= SDL_mixer.c [x86_64] Compile : SDL2 <= SDL_wave.c [x86_64] Compile : SDL2 <= SDL_androidaudio.c [x86_64] Compile : SDL2 <= SDL_dummyaudio.c [x86_64] Compile : SDL2 <= SDL_atomic.c [x86_64] Compile : SDL2 <= SDL_spinlock.c [x86_64] Compile : SDL2 <= SDL_android.c [x86_64] Compile : SDL2 <= SDL_cpuinfo.c [x86_64] Compile : SDL2 <= SDL_dynapi.c [x86_64] Compile : SDL2 <= SDL_clipboardevents.c [x86_64] Compile : SDL2 <= SDL_displayevents.c [x86_64] Compile : SDL2 <= SDL_dropevents.c [x86_64] Compile : SDL2 <= SDL_events.c /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:285:59: warning: format specifies type 'long long' but the argument has type 'SDL_TouchID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:282:50: note: expanded from macro 'PRINT_FINGER_EVENT' (uint) event->tfinger.timestamp, event->tfinger.touchId, \ ^~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:285:59: warning: format specifies type 'long long' but the argument has type 'SDL_FingerID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:283:17: note: expanded from macro 'PRINT_FINGER_EVENT' event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \ ^~~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:286:57: warning: format specifies type 'long long' but the argument has type 'SDL_TouchID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_FINGERUP) PRINT_FINGER_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:282:50: note: expanded from macro 'PRINT_FINGER_EVENT' (uint) event->tfinger.timestamp, event->tfinger.touchId, \ ^~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:286:57: warning: format specifies type 'long long' but the argument has type 'SDL_FingerID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_FINGERUP) PRINT_FINGER_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:283:17: note: expanded from macro 'PRINT_FINGER_EVENT' event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \ ^~~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:287:61: warning: format specifies type 'long long' but the argument has type 'SDL_TouchID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_FINGERMOTION) PRINT_FINGER_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:282:50: note: expanded from macro 'PRINT_FINGER_EVENT' (uint) event->tfinger.timestamp, event->tfinger.touchId, \ ^~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:287:61: warning: format specifies type 'long long' but the argument has type 'SDL_FingerID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_FINGERMOTION) PRINT_FINGER_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:283:17: note: expanded from macro 'PRINT_FINGER_EVENT' event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \ ^~~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:295:62: warning: format specifies type 'long long' but the argument has type 'SDL_TouchID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:292:51: note: expanded from macro 'PRINT_DOLLAR_EVENT' (uint) event->dgesture.timestamp, event->dgesture.touchId, \ ^~~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:295:62: warning: format specifies type 'long long' but the argument has type 'SDL_GestureID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:293:17: note: expanded from macro 'PRINT_DOLLAR_EVENT' event->dgesture.gestureId, (uint) event->dgesture.numFingers, \ ^~~~~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:296:61: warning: format specifies type 'long long' but the argument has type 'SDL_TouchID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:292:51: note: expanded from macro 'PRINT_DOLLAR_EVENT' (uint) event->dgesture.timestamp, event->dgesture.touchId, \ ^~~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:296:61: warning: format specifies type 'long long' but the argument has type 'SDL_GestureID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:293:17: note: expanded from macro 'PRINT_DOLLAR_EVENT' event->dgesture.gestureId, (uint) event->dgesture.numFingers, \ ^~~~~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:301:51: warning: format specifies type 'long long' but the argument has type 'SDL_TouchID' (aka 'long') [-Wformat] (uint) event->mgesture.timestamp, event->mgesture.touchId, ^~~~~~~~~~~~~~~~~~~~~~~ 11 warnings generated. [x86_64] Compile : SDL2 <= SDL_gesture.c [x86_64] Compile : SDL2 <= SDL_keyboard.c [x86_64] Compile : SDL2 <= SDL_mouse.c [x86_64] Compile : SDL2 <= SDL_quit.c [x86_64] Compile : SDL2 <= SDL_touch.c [x86_64] Compile : SDL2 <= SDL_windowevents.c [x86_64] Compile : SDL2 <= SDL_rwops.c [x86_64] Compile : SDL2 <= SDL_haptic.c [x86_64] Compile : SDL2 <= SDL_syshaptic.c [x86_64] Compile : SDL2 <= SDL_gamecontroller.c [x86_64] Compile : SDL2 <= SDL_joystick.c [x86_64] Compile : SDL2 <= SDL_sysjoystick.c [x86_64] Compile : SDL2 <= SDL_hidapi_ps4.c [x86_64] Compile : SDL2 <= SDL_hidapi_switch.c [x86_64] Compile : SDL2 <= SDL_hidapi_xbox360.c [x86_64] Compile : SDL2 <= SDL_hidapi_xboxone.c [x86_64] Compile : SDL2 <= SDL_hidapijoystick.c [x86_64] Compile : SDL2 <= SDL_sysloadso.c [x86_64] Compile : SDL2 <= SDL_power.c [x86_64] Compile : SDL2 <= SDL_syspower.c [x86_64] Compile : SDL2 <= SDL_sysfilesystem.c [x86_64] Compile : SDL2 <= SDL_sensor.c [x86_64] Compile : SDL2 <= SDL_androidsensor.c [x86_64] Compile : SDL2 <= SDL_d3dmath.c [x86_64] Compile : SDL2 <= SDL_render.c [x86_64] Compile : SDL2 <= SDL_yuv_sw.c [x86_64] Compile : SDL2 <= SDL_render_d3d.c [x86_64] Compile : SDL2 <= SDL_shaders_d3d.c [x86_64] Compile : SDL2 <= SDL_render_d3d11.c [x86_64] Compile : SDL2 <= SDL_shaders_d3d11.c [x86_64] Compile : SDL2 <= SDL_render_gl.c [x86_64] Compile : SDL2 <= SDL_shaders_gl.c [x86_64] Compile : SDL2 <= SDL_render_gles.c [x86_64] Compile : SDL2 <= SDL_render_gles2.c In file included from /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/render/opengles2/SDL_render_gles2.c:273: /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/render/opengles2/SDL_gles2funcs.h:58:1: warning: incompatible pointer types assigning to 'void (*)(GLuint, GLsizei, const GLchar **, const GLint *)' (aka 'void (*)(unsigned int, int, const char **, const int *)') from 'void (GLuint, GLsizei, const GLchar *const *, const GLint *)' (aka 'void (unsigned int, int, const char *const *, const int *)') [-Wincompatible-pointer-types] SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar **, const GLint *)) ^ ~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/render/opengles2/SDL_render_gles2.c:262:45: note: expanded from macro 'SDL_PROC' #define SDL_PROC(ret,func,params) data->func=func; ^~~~~ 1 warning generated. [x86_64] Compile : SDL2 <= SDL_shaders_gles2.c [x86_64] Compile : SDL2 <= SDL_render_psp.c [x86_64] Compile : SDL2 <= SDL_blendfillrect.c [x86_64] Compile : SDL2 <= SDL_blendline.c [x86_64] Compile : SDL2 <= SDL_blendpoint.c [x86_64] Compile : SDL2 <= SDL_drawline.c [x86_64] Compile : SDL2 <= SDL_drawpoint.c [x86_64] Compile : SDL2 <= SDL_render_sw.c [x86_64] Compile : SDL2 <= SDL_rotate.c [x86_64] Compile : SDL2 <= SDL_getenv.c [x86_64] Compile : SDL2 <= SDL_iconv.c [x86_64] Compile : SDL2 <= SDL_malloc.c [x86_64] Compile : SDL2 <= SDL_qsort.c [x86_64] Compile : SDL2 <= SDL_stdlib.c [x86_64] Compile : SDL2 <= SDL_string.c [x86_64] Compile : SDL2 <= SDL_thread.c [x86_64] Compile : SDL2 <= SDL_syscond.c [x86_64] Compile : SDL2 <= SDL_sysmutex.c [x86_64] Compile : SDL2 <= SDL_syssem.c [x86_64] Compile : SDL2 <= SDL_systhread.c [x86_64] Compile : SDL2 <= SDL_systls.c [x86_64] Compile : SDL2 <= SDL_timer.c [x86_64] Compile : SDL2 <= SDL_systimer.c [x86_64] Compile : SDL2 <= SDL_RLEaccel.c [x86_64] Compile : SDL2 <= SDL_blit.c [x86_64] Compile : SDL2 <= SDL_blit_0.c [x86_64] Compile : SDL2 <= SDL_blit_1.c [x86_64] Compile : SDL2 <= SDL_blit_A.c [x86_64] Compile : SDL2 <= SDL_blit_N.c [x86_64] Compile : SDL2 <= SDL_blit_auto.c [x86_64] Compile : SDL2 <= SDL_blit_copy.c [x86_64] Compile : SDL2 <= SDL_blit_slow.c [x86_64] Compile : SDL2 <= SDL_bmp.c [x86_64] Compile : SDL2 <= SDL_clipboard.c [x86_64] Compile : SDL2 <= SDL_egl.c [x86_64] Compile : SDL2 <= SDL_fillrect.c [x86_64] Compile : SDL2 <= SDL_pixels.c [x86_64] Compile : SDL2 <= SDL_rect.c [x86_64] Compile : SDL2 <= SDL_shape.c [x86_64] Compile : SDL2 <= SDL_stretch.c [x86_64] Compile : SDL2 <= SDL_surface.c [x86_64] Compile : SDL2 <= SDL_video.c [x86_64] Compile : SDL2 <= SDL_vulkan_utils.c [x86_64] Compile : SDL2 <= SDL_yuv.c [x86_64] Compile : SDL2 <= SDL_androidclipboard.c [x86_64] Compile : SDL2 <= SDL_androidevents.c [x86_64] Compile : SDL2 <= SDL_androidgl.c [x86_64] Compile : SDL2 <= SDL_androidkeyboard.c [x86_64] Compile : SDL2 <= SDL_androidmessagebox.c [x86_64] Compile : SDL2 <= SDL_androidmouse.c [x86_64] Compile : SDL2 <= SDL_androidtouch.c [x86_64] Compile : SDL2 <= SDL_androidvideo.c [x86_64] Compile : SDL2 <= SDL_androidvulkan.c [x86_64] Compile : SDL2 <= SDL_androidwindow.c [x86_64] Compile : SDL2 <= yuv_rgb.c [x86_64] Compile : SDL2 <= SDL_test_assert.c [x86_64] Compile : SDL2 <= SDL_test_common.c [x86_64] Compile : SDL2 <= SDL_test_compare.c [x86_64] Compile : SDL2 <= SDL_test_crc32.c [x86_64] Compile : SDL2 <= SDL_test_font.c [x86_64] Compile : SDL2 <= SDL_test_fuzzer.c [x86_64] Compile : SDL2 <= SDL_test_harness.c [x86_64] Compile : SDL2 <= SDL_test_imageBlit.c [x86_64] Compile : SDL2 <= SDL_test_imageBlitBlend.c [x86_64] Compile : SDL2 <= SDL_test_imageFace.c [x86_64] Compile : SDL2 <= SDL_test_imagePrimitives.c [x86_64] Compile : SDL2 <= SDL_test_imagePrimitivesBlend.c [x86_64] Compile : SDL2 <= SDL_test_log.c [x86_64] Compile : SDL2 <= SDL_test_md5.c [x86_64] Compile : SDL2 <= SDL_test_memory.c [x86_64] Compile : SDL2 <= SDL_test_random.c [x86_64] Compile++ : hidapi <= hid.cpp [x86_64] Prebuilt : libc++_shared.so <= <NDK>/sources/cxx-stl/llvm-libc++/libs/x86_64/ [x86_64] SharedLibrary : libhidapi.so [x86_64] SharedLibrary : libSDL2.so /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/build/intermediates/ndkBuild/debug/obj/local/x86_64/objs-debug/SDL2/src/audio/SDL_audio.o:SDL_audio.c:bootstrap: error: undefined reference to 'openslES_bootstrap' /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/video/android/SDL_androidevents.c:105: error: undefined reference to 'openslES_PauseDevices' /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/video/android/SDL_androidevents.c:112: error: undefined reference to 'openslES_ResumeDevices' /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/video/android/SDL_androidevents.c:156: error: undefined reference to 'openslES_PauseDevices' /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/video/android/SDL_androidevents.c:167: error: undefined reference to 'openslES_ResumeDevices' clang++: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/build/intermediates/ndkBuild/debug/obj/local/x86_64/libSDL2.so] Error 1 ``` 感觉是调用opengl 的相关库时报错,未引用。请教有遇到过此类问题的或者有解决思路的,请不吝赐教。。
Android 播放视频线有绿条闪烁
系统是飞思卡尔的Android6.0, 我自己写个小demo播放视频没有问题。 但是客户自己写的apk安装到我们的系统上就出现绿条在闪。 apk里面用到了MediaPlayer,GLES20,SurfaceTexture,还有一个com.badlogic.gdx(好像是什么游戏框架) 注:有的视频会有的视频不会,视频播放时感觉系统比较卡顿![图片说明](https://img-ask.csdn.net/upload/201710/17/1508200445_316910.jpg)![图片说明](https://img-ask.csdn.net/upload/201710/17/1508200470_656315.jpg)
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私有的数
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
此博客仅为我业余记录文章所用,发布到此,仅供网友阅读参考,如有侵权,请通知我,我会删掉。 补充 有不少读者留言说本文章没有用,因为天气预报直接打开手机就可以收到了,为何要多此一举发送到邮箱呢!!!那我在这里只能说:因为你没用,所以你没用!!! 这里主要介绍的是思路,不是天气预报!不是天气预报!!不是天气预报!!!天气预报只是用于举例。请各位不要再刚了!!! 下面是我会用到的两个场景: 每日下
面试官问我:什么是消息队列?什么场景需要他?用了会出现什么问题?
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸,打败了无数
8年经验面试官详解 Java 面试秘诀
    作者 | 胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外
大学四年自学走来,这些珍藏的「实用工具/学习网站」我全贡献出来了
知乎高赞:文中列举了互联网一线大厂程序员都在用的工具集合,涉及面非常广,小白和老手都可以进来看看,或许有新收获。
《阿里巴巴开发手册》读书笔记-编程规约
Java编程规约命名风格 命名风格 类名使用UpperCamelCase风格 方法名,参数名,成员变量,局部变量都统一使用lowerCamelcase风格 常量命名全部大写,单词间用下划线隔开, 力求语义表达完整清楚,不要嫌名字长 ...
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip install selenium -i https://pypi.tuna.tsinghua.edu.cn/simple/ 
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
你知道的越多,你不知道的越多 点赞再看,养成习惯 本文 GitHub https://github.com/JavaFamily 已收录,有一线大厂面试点思维导图,也整理了很多我的文档,欢迎Star和完善,大家面试可以参照考点复习,希望我们一起有点东西。 前前言 为啥今天有个前前言呢? 因为你们的丙丙啊,昨天有牌面了哟,直接被微信官方推荐,知乎推荐,也就仅仅是还行吧(心里乐开花)
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca
Python爬虫精简步骤1 获取数据
爬虫的工作分为四步: 1.获取数据。爬虫程序会根据我们提供的网址,向服务器发起请求,然后返回数据。 2.解析数据。爬虫程序会把服务器返回的数据解析成我们能读懂的格式。 3.提取数据。爬虫程序再从中提取出我们需要的数据。 4.储存数据。爬虫程序把这些有用的数据保存起来,便于你日后的使用和分析。 这一篇的内容就是:获取数据。 首先,我们将会利用一个强大的库——requests来获取数据。 在电脑上安装
Python绘图,圣诞树,花,爱心 | Turtle篇
1.画圣诞树 import turtle screen = turtle.Screen() screen.setup(800,600) circle = turtle.Turtle() circle.shape('circle') circle.color('red') circle.speed('fastest') circle.up() square = turtle.Turtle()
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东
破14亿,Python分析我国存在哪些人口危机!
2020年1月17日,国家统计局发布了2019年国民经济报告,报告中指出我国人口突破14亿。 猪哥的朋友圈被14亿人口刷屏,但是很多人并没有看到我国复杂的人口问题:老龄化、男女比例失衡、生育率下降、人口红利下降等。 今天我们就来分析一下我们国家的人口数据吧! 更多有趣分析教程,扫描下方二维码关注vx公号「裸睡的猪」 即可查看! 一、背景 1.人口突破14亿 2020年1月17日,国家统计局发布
听说想当黑客的都玩过这个Monyer游戏(1~14攻略)
第零关 进入传送门开始第0关(游戏链接) 请点击链接进入第1关: 连接在左边→ ←连接在右边 看不到啊。。。。(只能看到一堆大佬做完的留名,也能看到菜鸡的我,在后面~~) 直接fn+f12吧 &lt;span&gt;连接在左边→&lt;/span&gt; &lt;a href="first.php"&gt;&lt;/a&gt; &lt;span&gt;←连接在右边&lt;/span&gt; o
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ......
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!
别低估自己的直觉,也别高估自己的智商
所有群全部吵翻天,朋友圈全部沦陷,公众号疯狂转发。这两周没怎么发原创,只发新闻,可能有人注意到了。我不是懒,是文章写了却没发,因为大家的关注力始终在这次的疫情上面,发了也没人看。当然,我...
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。   再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。   下文是原回答,希望能对你能有所启发。   如果我说,这个世界上人真的分三六九等,
为什么听过很多道理,依然过不好这一生?
记录学习笔记是一个重要的习惯,不希望学习过的东西成为过眼云烟。做总结的同时也是一次复盘思考的过程。 本文是根据阅读得到 App上《万维钢·精英日课》部分文章后所做的一点笔记和思考。学习是一个系统的过程,思维模型的建立需要相对完整的学习和思考过程。以下观点是在碎片化阅读后总结的一点心得总结。
B 站上有哪些很好的学习资源?
哇说起B站,在小九眼里就是宝藏般的存在,放年假宅在家时一天刷6、7个小时不在话下,更别提今年的跨年晚会,我简直是跪着看完的!! 最早大家聚在在B站是为了追番,再后来我在上面刷欧美新歌和漂亮小姐姐的舞蹈视频,最近两年我和周围的朋友们已经把B站当作学习教室了,而且学习成本还免费,真是个励志的好平台ヽ(.◕ฺˇд ˇ◕ฺ;)ノ 下面我们就来盘点一下B站上优质的学习资源: 综合类 Oeasy: 综合
如何优雅地打印一个Java对象?
你好呀,我是沉默王二,一个和黄家驹一样身高,和刘德华一样颜值的程序员。虽然已经写了十多年的 Java 代码,但仍然觉得自己是个菜鸟(请允许我惭愧一下)。 在一个月黑风高的夜晚,我思前想后,觉得再也不能这么蹉跎下去了。于是痛下决心,准备通过输出的方式倒逼输入,以此来修炼自己的内功,从而进阶成为一名真正意义上的大神。与此同时,希望这些文章能够帮助到更多的读者,让大家在学习的路上不再寂寞、空虚和冷。 ...
雷火神山直播超两亿,Web播放器事件监听是怎么实现的?
Web播放器解决了在手机浏览器和PC浏览器上播放音视频数据的问题,让视音频内容可以不依赖用户安装App,就能进行播放以及在社交平台进行传播。在视频业务大数据平台中,播放数据的统计分析非常重要,所以Web播放器在使用过程中,需要对其内部的数据进行收集并上报至服务端,此时,就需要对发生在其内部的一些播放行为进行事件监听。 那么Web播放器事件监听是怎么实现的呢? 01 监听事件明细表 名
3万字总结,Mysql优化之精髓
本文知识点较多,篇幅较长,请耐心学习 MySQL已经成为时下关系型数据库产品的中坚力量,备受互联网大厂的青睐,出门面试想进BAT,想拿高工资,不会点MySQL优化知识,拿offer的成功率会大大下降。 为什么要优化 系统的吞吐量瓶颈往往出现在数据库的访问速度上 随着应用程序的运行,数据库的中的数据会越来越多,处理时间会相应变慢 数据是存放在磁盘上的,读写速度无法和内存相比 如何优化 设计
Linux 命令(122)—— watch 命令
1.命令简介 2.命令格式 3.选项说明 4.常用示例 参考文献 [1] watch(1) manual
Linux 命令(121)—— cal 命令
1.命令简介 2.命令格式 3.选项说明 4.常用示例 参考文献 [1] cal(1) manual
记jsp+servlet+jdbc实现的新闻管理系统
1.工具:eclipse+SQLyog 2.介绍:实现的内容就是显示新闻的基本信息,然后一个增删改查的操作。 3.数据库表设计 列名 中文名称 数据类型 长度 非空 newsId 文章ID int 11 √ newsTitle 文章标题 varchar 20 √ newsContent 文章内容 text newsStatus 是否审核 varchar 10 news...
Python新型冠状病毒疫情数据自动爬取+统计+发送报告+数据屏幕(三)发送篇
今天介绍的项目是使用 Itchat 发送统计报告 项目功能设计: 定时爬取疫情数据存入Mysql 进行数据分析制作疫情报告 使用itchat给亲人朋友发送分析报告(本文) 基于Django做数据屏幕 使用Tableau做数据分析 来看看最终效果 目前已经完成,预计2月12日前更新 使用 itchat 发送数据统计报告 itchat 是一个基于 web微信的一个框架,但微信官方并不允
相关热词 c#开发的dll注册 c#的反射 c# grid绑定数据源 c#多线程怎么循环 c# 鼠标左键 c# char占位符 c# 日期比较 c#16进制转换为int c#用递归求顺序表中最大 c#小型erp源代码
立即提问