Execution failed for task ' app transformNative libsWithStri

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

                       

转载请标明出处:http://blog.csdn.net/xx326664162/article/details/53174954    文章出自:薛瑄的博客

你可以查看我的其他同类文章,也会让你有一定的收货

环境

MIUI8 Android 6.0 
Android studio 2.2.2 
Gradle版本:gradle-2.14.1-all 
NDK版本:android-ndk-r10

项目的build.gradle:

apply plugin: 'com.android.application'android {    compileSdkVersion 24    buildToolsVersion "24.0.3"    defaultConfig {        applicationId "cn.runvision.facedetect"        minSdkVersion 19        targetSdkVersion 21        versionCode 1        versionName "1.0"        ndk {            moduleName "face_identify"            abiFilters 'armeabi', 'armeabi-v7a'        }    }    buildTypes {        release {            minifyEnabled false            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'        }    }}dependencies {    //compile 'com.android.support:support-v4:20.0.0'//    compile 'com.android.support:appcompat-v7:24.2.1'    compile files('libs/cardsdk.jar')    compile files('libs/idcardreadlib_hx.jar')    compile files('libs/FaceNative.jar')    compile files('libs/jxl.jar')    compile files('libs/readcard0.jar')    compile 'com.tencent.bugly:crashreport:2.3.1' //其中latest.release指代最新Bugly SDK版本号,也可以指定明确的版本号,例如2.1.9    compile 'com.tencent.bugly:nativecrashreport:3.0' //其中latest.release指代最新Bugly NDK版本号,也可以指定明确的版本号,例如3.0}
   
   
  • 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

android-ndk-r13   minSdkVersion 19,可以正常运行在MIUI8 Android 6.0 系统上

后来为了运行在android 4.2.2 API=17,改为了minSdkVersion 17,出现了下面这个错误

问题1

E/dalvikvm(5657): dlopen("/data/app-lib/net.shanggame.pantheon-1/libgameshared.so") failed: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "rand" referenced by "libgameshared.so"...
   
   
  • 1

参考这篇博客:运行报错:java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_relocate(linker.cpp:975)

how to use mkfifo using Android’s NDK

把ndk版本降低为android-ndk-r10,在build时,出现了下面这个错误

最后发现是java声明的一个原生方法名出错

问题2:

Error:注: 某些输入文件使用或覆盖了已过时的 API。注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。注: 某些输入文件使用了未经检查或不安全的操作。注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。FAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':app:transformNative_libsWithStripDebugSymbolForDebug'.> java.lang.NullPointerException (no error message)* Try:Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
   
   
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

参考这篇博客项目由android studio 2.1.3升级到2.2后出现无法build的问题?

Android builds don’t work with NDK r10 when running on Android 4.x devices

他是把 NDK版本改为12,解决这个问题的,我测试还是不行,又改为了android-ndk-r10

第一次尝试

后来继续把 buildToolsVersion 改为 “19.1”(在Android SDK Manager中能下载到的最低版本,本来想找17版本的),这个错误继续存在,还多出现了问题三这个警告,

第二次尝试

我后来看了Gradle Console的构建信息,好像是bugly的相关so库找不到,我把build.gradle这行代码注释掉就可以了运行了,但是又出现了问题一

   compile 'com.tencent.bugly:nativecrashreport:3.0' //其中latest.release指代最新Bugly NDK版本号,也可以指定明确的版本号,例如3.0
   
   
  • 1
  • 2

问题3:

Warning:Project is building density based multiple APKs but using tools version 19, you should upgrade to build-tools 21 or above to ensure proper packaging of resources.
   
   
  • 1

参考:
项目由android studio 2.1.3升级到2.2后出现无法build的问题?

 

关注我的公众号,轻松了解和学习更多技术
  这里写图片描述

           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

猜你喜欢

转载自blog.csdn.net/qq_43667831/article/details/84103823