我想嘲弄的Android应用程序发布版型位置。我创建了一个特殊的香味的mockable的体现在应用程序/ src目录/ mockable / AndroidManifest.xml中
I'd like to mock locations in release build type of Android app. I've created a special flavour "mockable" manifest in app/src/mockable/AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
</manifest>
但似乎使用的发行版本类型此权限的Android皮棉块。对于命令:
But it seems that Android lint blocks from using this permissions in release build type. For command:
./gradlew assembleRelease
我得到的输出:
I got output:
:app:lintVitalMockableRelease
/home/fr/app/src/mockable/AndroidManifest.xml:3: Error: Mock locations should only be requested in a debug-specific manifest file (typically src/debug/AndroidManifest.xml) [MockLocation]
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Explanation for issues of type "MockLocation":
Using a mock location provider (by requiring the permission
android.permission.ACCESS_MOCK_LOCATION) should only be done in debug
builds. In Gradle projects, that means you should only request this
permission in a debug source set specific manifest file.
To fix this, create a new manifest file in the debug folder and move the
<uses-permission> element there. A typical path to a debug manifest
override file in a Gradle project is src/debug/AndroidManifest.xml.
1 errors, 0 warnings
是否有可能产生与位置嘲讽许可版本的应用程序?
我肯定知道的唯一的解决办法就是让皮棉报告错误,但不要让这种中止构建过程:
The only solution I know for sure is to let lint report errors but don't let that abort the build process:
要启用只需添加
lintOptions {
abortOnError false
}
在机器人
块内。
您仍然会得到皮棉错误和警告,但构建仍将继续。
You will still get lint errors and warnings but the build will continue.
我不知道,如果你可以把那个味道定义中可以使用自定义buildType了点。我没有计划在那里我可以测试。
I am not sure if you can put that inside the flavor definition or use a custom buildType for that. I have no project where I could test that.