android-log

Android faac x264 rtmp camera2推流b站直播

浪子不回头ぞ 提交于 2021-01-30 01:43:39
package com.zzm.play.x264 ; import android.os.Bundle ; import android.support.annotation. Nullable ; import android.support.v7.app.AppCompatActivity ; import android.view.TextureView ; import android.view.View ; import com.zzm.play.R ; import com.zzm.play.utils.PermissionUtil ; public class MyActivity extends AppCompatActivity { @Override protected void onCreate ( @Nullable Bundle savedInstanceState) { super .onCreate(savedInstanceState) ; setContentView(R.layout. x264_camera2_layout ) ; init() ; doSomeThing() ; } private Camera2Tool camera2Tool ; private TextureView textureView ; private void

error undefined reference to __android_log_print

血红的双手。 提交于 2020-08-17 08:52:56
error undefined reference to '__android_log_print 配置 Android.mk文件 输入 LOCAL_LDLIBS := -llog 打印日志库 注意:LOCAL_LDLIBS要写在MODULE前面(也可能别的前面)就生效了 LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_LDLIBS := -llog LOCAL_MODULE := ccalljava LOCAL_SRC_FILES := CCallJava.c include $(BUILD_SHARED_LIBRARY) 来源: oschina 链接: https://my.oschina.net/u/4290180/blog/4308244

深入浅出Android NDK之打印调用堆栈

随声附和 提交于 2020-08-12 08:12:53
目录 上一篇 深入浅出Android NDK之崩溃分析 为了能在native层打印函数的调用堆栈,找了好久的资料,最后终于找到一个靠谱的链接: https://www.jianshu.com/p/4a5eeeee6d29 主要通过调用_Unwind_Backtrace函数来获得函数的调用堆栈,但是原文的并不好用,地址通过addr2line转换以后得不到函数名和行号,主要原因我们得到的地址是运行时地址,应该减去SO的基地址再来转换,下面看我改造后的例子,更好用。 #include <unwind.h> #include <dlfcn.h> #include <vector> #include <string> #include <android/log.h> static _Unwind_Reason_Code unwindCallback(struct _Unwind_Context* context, void* arg) { std::vector<_Unwind_Word> &stack = *(std::vector<_Unwind_Word>*)arg; stack.push_back(_Unwind_GetIP(context)); return _URC_NO_REASON; } void callstackDump(std::string &dump) { std:

BuildConfig.DEBUG always return false

不羁岁月 提交于 2020-06-10 07:30:29
问题 Why does BuildConfig.DEBUG return false, when I run the application? I use it to control the log like the following: public static void d(String LOG_TAG, String msg){ if(BuildConfig.DEBUG){ Log.d(LOG_TAG,msg); } } 回答1: In your Android Studio build variant are you on debug variant? That is applied when you use flavors , either for debug or release . in the debug mode, BuildConfig.BUILD is true, and in the release mode, it is false. 回答2: Check imports in the class, make sure you are using

JNI通过形参返回String的方法

梦想的初衷 提交于 2020-04-06 13:30:48
标题虽说是String但实际使用了StringBuffer 很简单,往下看吧,直接cp过去就可以用了。 public class Decodec { public static native int test(String inPut, StringBuffer outPut); static { System.loadLibrary("decodec"); } } #include <android/log.h> #include <string.h> /* * Class: jp_ac_jaist_myjnitest_Codec * Method: test * Signature: (Ljava/lang/String;Ljava/lang/StringBuffer;)I */ JNIEXPORT jint JNICALL Java_jp_ac_jaist_myjnitest_Codec_test (JNIEnv* env, jclass, jstring inputStrJstr, jobject outputJobj) { const char* pInputStr = env->GetStringUTFChars(inputStrJstr, JNI_FALSE); if (pInputStr == NULL) { return -1; } __android_log

Android Log.v(),Log.d(),Log.i(),Log.w(),Log.e()

廉价感情. 提交于 2020-03-20 19:47:00
3 月,跳不动了?>>> 不同的 LogCat 方法是: Log.v(); // Verbose Log.d(); // Debug Log.i(); // Info Log.w(); // Warning Log.e(); // Error 使用每种类型的日志记录的适当情况是什么? 我知道也许这只是一些语义,也许它并不重要,但对于Android Studio和Eclipse中的 LogCat 过滤,我很高兴知道我在适当的时候使用了正确的方法。 #1楼 源代码 提供了一些基本指导: 详细程度的顺序,从最小到最多,是ERROR,WARN,INFO,DEBUG,VERBOSE。 除了在开发期间,不应该将详细编译到应用程序中。 调试日志在运行时编译但被剥离。 始终保留错误,警告和信息日志。 更多细节,Kurtis的答案已经过去了。 我想补充一点:不要在 INFO 或以上( WARN / ERROR )记录任何个人身份信息或私人信息。 否则,错误报告或包含日志记录的任何其他内容可能会受到污染。 #2楼 Android Studio网站 最近(我认为)提供了一些建议,从Kurtis的回答中可能有用的不同日志级别期望什么样的消息: 详细 - 显示所有日志消息(默认)。 调试 - 显示仅在开发期间有用的调试日志消息,以及此列表中较低的消息级别。 信息 - 显示常规使用的预期日志消息

How to unit test Log.e in android?

柔情痞子 提交于 2020-01-04 02:45:09
问题 I need to perform an unit test where I need to check if an error message is logged when a certain condition occurs in my app. try { //do something } catch (ClassCastException | IndexOutOfBoundsException e) { Log.e(INFOTAG, "Exception "+e.getMessage()); } How can I test this? I am getting the below error while unit testing. Caused by: java.lang.RuntimeException: Method e in android.util.Log not mocked. 回答1: There are two ways to do this: You turn to Powermock or Powermokito; as those mocking

Why Android TimingLogger is not able to print logs?

不想你离开。 提交于 2020-01-01 08:04:16
问题 I am trying to use TimingLogger for checking time consumed for a particular method and its statements. But Android TimingLogger is not able to print logs. 回答1: If the Log.isLoggable is not enabled to at least the Log.VERBOSE level for that tag at creation time then the addSplit and dumpToLog call will do nothing. If you simply looking for logs as explained in https://developer.android.com, you will not be able to see logs. So use below command in adb: adb shell setprop log.tag.MyTag VERBOSE

Why Android TimingLogger is not able to print logs?

人盡茶涼 提交于 2020-01-01 08:04:06
问题 I am trying to use TimingLogger for checking time consumed for a particular method and its statements. But Android TimingLogger is not able to print logs. 回答1: If the Log.isLoggable is not enabled to at least the Log.VERBOSE level for that tag at creation time then the addSplit and dumpToLog call will do nothing. If you simply looking for logs as explained in https://developer.android.com, you will not be able to see logs. So use below command in adb: adb shell setprop log.tag.MyTag VERBOSE

Logback-android: Log not getting writen to a file

我的梦境 提交于 2019-12-23 08:12:08
问题 Trying to redirect the log messages using logback-android, so that messages can be saved in a file. However, it is not getting saved into a file. This is my logback.xml file configration, which is stored under src/main/assets in my Android Studio <configuration debug="true"> <!-- Create a file appender for a log in the application's data directory --> <appender name="FILE" class="ch.qos.logback.classic.android.FileAppender"> <file>/data/com.test.equa/files/log/foo.log</file> <encoder>