Pra*_*kar 5 xml android gradle android-syncadapter android-productflavors
我为我的Android应用程序定义了一些flavor和buildTypes
productFlavors {
X {
applicationId = "com.x.xxxx"
}
Y {
applicationId = "com.y.yyyy"
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard_rules.txt'
}
debug {
applicationIdSuffix ".debug"
}
}
Run Code Online (Sandbox Code Playgroud)
这样做可以创建不同的flavor/buildType组合.
现在为了确保ContentProviders
工作而我没有收到Failure [INSTALL_FAILED_CONFLICTING_PROVIDER]
错误,我已将代码中的android:authorities="${applicationId}"
和AUTHORITY
引用更改为BuildConfig.APPLICATION_ID
.
这使得ContentProvider
工作正常,即当我在同一部手机上安装两种不同类型时,它不会引发错误.它让我安装它们.
下一步是错误发生的地方.我使用SyncAdapter
并AccountManager
控制一些事情.我已修改ACCOUNT_TYPE
使用了APPLICATION_ID
.因为不能够使用gradle这个问题的${applicationId}
非清单XML资源文件,我已经创造了每味不同的目录结构和复制syncadapter.xml
,并authenticator.xml
有相应的authority
和account type
字符串.
我也尝试过这个博客中描述的技术 - http://blog.jensdriller.com/android-gradle-workaround-for-missing-placeholder-support-in-resource-files/
最受欢迎的答案是在Gradle中使用构建类型来运行在一台设备上使用ContentProvider的相同应用程序但事情似乎不起作用.
有人能够最近上班吗?
归档时间: |
|
查看次数: |
314 次 |
最近记录: |