build.gradle中ndk节内增加abiFilters
1 2 3 4 5 6 7 8 | android { defaultConfig { ... ndk { abiFilters 'armeabi-v7a' } } } |
refer to: https://www.jianshu.com/p/3b58174e89f1
人,技术,生活。
build.gradle中ndk节内增加abiFilters
1 2 3 4 5 6 7 8 | android { defaultConfig { ... ndk { abiFilters 'armeabi-v7a' } } } |
refer to: https://www.jianshu.com/p/3b58174e89f1
现象:
Build -> Make Project生成的apk包中含lib文件夹及里面的.so动态库,而点击IDE中的Debug按钮后发现生成的apk包中lib文件夹及.so库都没了。
解决方法:
在右上角“Make Project(Ctrl + F9)”图标的右边下拉框中点击“Edit Configurations...”,在“Run/Debug Configurations”对话框中,选择app -> General -> Installation Options -> Deploy下拉框的“APK from app bundle”,并点击OK保存。这样点击IDE中的Debug按钮后,传到设备中进行交互调试的apk中也会包含进lib内容。
有几点须注意,
以下是源码,摘选自EuhatRtsp开源软件,经历过长时间拷机运行没问题。其网址是:http://euhat.com/rtsp.html
DecoderHard.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #pragma once #include "DecodeOp.h" class AMediaCodec; class EuhatDecoderHard : public EuhatDecoderBase { int updateSpsAndPps(); int spsChanged_; int ppsChanged_; char *sps_; char *pps_; int width_; int height_; int oriHeight_; int colorFormat_; int stride_; int sliceHeight_; int cropTop_; int cropBottom_; int cropLeft_; int cropRight_; int isCodecInited_; void *surface_; int surfaceChanged_; public: EuhatDecoderHard(); virtual ~EuhatDecoderHard(); virtual int init(EuhatDecoderCallback callback, void *context); virtual int fini(); virtual int updateSps(const char *sps); virtual int updatePps(const char *pps); virtual int updateWH(int width, int height); virtual int updateSurface(void *surface); virtual int decode(char *frame, int frameLen); static int canWork(); AMediaCodec *mediaCodec_; }; |