1 新建工程编译无法通过, 出现
Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
> Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.
解决方式:
在module的build.gradle的顶级目录加上
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:27.1.1'
}
2 使用Cmake的时候无法编译
错误信息:
Error:(136) undefined reference to 'std::logic_error::logic_error(char const*)' with cmake
解决方法:
如下图, 在cmake节点加上 arguments “-DANDROID_STL=stlport_static”
externalNativeBuild {
cmake {
arguments "-DANDROID_STL=stlport_static"
cppFlags "-frtti -fexceptions"
}
}