- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
最近将 Firebase-Firestore 添加到我的 Android 项目中,并在构建时开始获取对 protobuf 中的类的重复引用。
build.gradle
// Top-level build file where you can add configuration options common to all
// sub-projects/modules.
buildscript {
ext.protobufVersion = '0.8.6'
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jcenter.bintray.com" }
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'io.fabric.tools:gradle:1.31.2'
classpath 'com.google.gms:google-services:4.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.41"
classpath 'com.akaita.android:easylauncher:1.3.1'
classpath "com.google.protobuf:protobuf-gradle-plugin:$protobufVersion"
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.akaita.android.easylauncher'
apply plugin: 'com.google.protobuf'
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.fabric.io/public' }
}
configurations {
playstoreImplementation
compatImplementation
freeCompatImplementation
stagingCompatImplementation
}
ext {
supportLibVersion = '28.0.0'
}
dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
/*playstoreImplementation('com.google.firebase:firebase-messaging:15.0.2') {
exclude group: 'com.google.firebase', module: 'firebase-core'
}*/
compatImplementation 'androidx.emoji:emoji-appcompat:1.0.0'
freeCompatImplementation 'androidx.emoji:emoji-bundled:1.0.0'
stagingCompatImplementation 'androidx.emoji:emoji-bundled:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'org.sufficientlysecure:openpgp-api:10.0'
implementation 'com.github.inputmice:Android-Image-Cropper:2.7.2'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.emoji:emoji:1.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha07'
implementation 'org.bouncycastle:bcmail-jdk15on:1.58'
implementation 'org.whispersystems:signal-protocol-java:2.6.2'
implementation 'org.conscrypt:conscrypt-android:1.3.0'
implementation 'rocks.xmpp:xmpp-addr:0.8.0'
implementation 'org.osmdroid:osmdroid-android:6.0.1'
implementation 'de.measite.minidns:minidns-hla:0.2.4'
implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'com.wefika:flowlayout:0.4.1'
implementation 'net.ypresto.androidtranscoder:android-transcoder:0.2.0'
implementation 'org.hsluv:hsluv:0.2'
//Butterknife dependency
implementation 'com.jakewharton:butterknife:10.2.0'
kapt 'com.jakewharton:butterknife-compiler:10.2.0'
//Network Retrofit and okhttp
implementation('com.squareup.retrofit2:retrofit:2.1.0') {
// exclude Retrofit’s OkHttp dependency module and define your own module import
exclude module: 'okhttp'
}
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.hbb20:ccp:2.2.3'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.crashlytics.sdk.android:answers:1.4.7'
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation 'com.google.firebase:firebase-messaging:20.1.0'
implementation 'com.google.firebase:firebase-config:19.1.0'
implementation 'com.google.firebase:firebase-dynamic-links:19.0.0'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.firebase:firebase-firestore:21.3.1'
implementation 'com.wdullaer:swipeactionadapter:2.0.0'
implementation 'com.wdullaer:materialdatetimepicker:3.2.0'
implementation 'io.michaelrocks:libphonenumber-android:8.10.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'ch.halcyon:squareprogressbar:1.6.4'
implementation 'com.github.zawadz88:material-activity-chooser:0.2.2'
implementation 'com.urbanairship.android:urbanairship-fcm:11.0.1'
implementation 'commons-codec:commons-codec:1.12'
implementation 'com.github.kal72:RackMonthPicker:1.6.0'
implementation "android.arch.work:work-runtime:1.0.0-alpha11"
implementation 'org.apache.commons:commons-lang3:3.9'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.google.android.play:core:1.6.4'
implementation 'com.google.protobuf:protobuf-lite:3.0.1'
//What's new library
implementation('io.github.tonnyl:whatsnew:0.1.2') {
exclude module: 'annotations'
}
//Showcase view library
implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.mikhaellopez:circularimageview:3.2.0'
implementation 'com.facebook.fresco:fresco:2.0.0'
implementation files('libs/YouTubeAndroidPlayerApi.jar')
//firebase analytics
implementation 'com.google.firebase:firebase-analytics:17.2.0'
//https://jitpack.io/p/kapilmhr/AlphabetIndexFastScrollRecyclerview
implementation 'com.github.kapilmhr:AlphabetIndexFastScrollRecyclerview:1.0.0'
}
ext {
travisBuild = System.getenv("TRAVIS") == "true"
preDexEnabled = System.getProperty("pre-dex", "true")
}
android {
compileSdkVersion 28
signingConfigs {
company{
{...}
}
}
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionCode 120
versionName "2.10.3"
archivesBaseName += "-$versionName"
applicationId "com.company.chat"
resValue "string", "applicationId", applicationId
resValue "string", "app_name", "Company"
multiDexEnabled true
vectorDrawables {
useSupportLibrary = true
}
}
dataBinding {
enabled true
}
dexOptions {
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
preDexLibraries = preDexEnabled && !travisBuild
jumboMode true
javaMaxHeapSize "2g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions("distribution", "emoji")
productFlavors {
/*playstore {
dimension "distribution"
versionNameSuffix "+p"
}*/
free {
dimension "distribution"
{...}
}
staging {
dimension "distribution"
{...}
system {
dimension "emoji"
versionNameSuffix "s"
}
compat {
dimension "emoji"
}
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//versionNameSuffix "r"
signingConfig signingConfigs.company
zipAlignEnabled true
}
debug {
applicationIdSuffix ".dev"
shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
disable 'MissingTranslation', 'InvalidPackage', 'MissingQuantity', 'AppCompatResource'
}
subprojects {
afterEvaluate {
if (getPlugins().hasPlugin('android') ||
getPlugins().hasPlugin('android-library')) {
configure(android.lintOptions) {
disable 'AndroidGradlePluginVersion', 'MissingTranslation'
}
}
}
}
packagingOptions {
exclude 'META-INF/BCKEY.DSA'
exclude 'META-INF/BCKEY.SF'
}
// https://proandroiddev.com/how-to-setup-your-android-app-to-use-protobuf-96132340de5c
// Added to fix duplicate classes issue
protobuf {
protoc {
// You still need protoc like in the non-Android case
artifact = 'com.google.protobuf:protoc:3.0.0'
}
plugins {
javalite {
// The codegen for lite comes as a separate artifact
artifact = 'com.google.protobuf:protoc-gen-javalite:3.0.0'
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
// In most cases you don't need the full Java output
// if you use the lite output.
remove java
}
task.plugins {
javalite { }
}
}
}
}
sourceSets{
main.java.srcDirs += "${protobuf.generatedFilesBaseDir}/main/javalite"
}
}
为了修复该错误,我遵循了解决方案 here和 here ,我继续在 protobuf 中收到以下错误。
Duplicate class com.google.protobuf.AbstractMessageLite found in modules protobuf-java-2.5.0.jar (com.google.protobuf:protobuf-java:2.5.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.AbstractMessageLite$Builder found in modules protobuf-java-2.5.0.jar (com.google.protobuf:protobuf-java:2.5.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream found in modules protobuf-java-2.5.0.jar (com.google.protobuf:protobuf-java:2.5.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.AbstractParser found in modules protobuf-java-2.5.0.jar (com.google.protobuf:protobuf-java:2.5.0) and protobuf-lite-3.0.1.jar) com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.ByteString found in modules protobuf-java-2.5.0.jar (com.google.protobuf:protobuf-java:2.5.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.ByteString$1 found in modules protobuf-java-2.5.0.jar (com.google.protobuf:protobuf-java:2.5.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.ByteString$ByteIterator found in modules protobuf-java-2.5.0.jar (com.google.protobuf:protobuf-java:2.5.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.ByteString$CodedBuilder found in modules protobuf-java-2.5.0.jar (com.google.protobuf:protobuf-java:2.5.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.ByteString$Output found in modules protobuf-java-2.5.0.jar (com.google.protobuf:protobuf-java:2.5.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.CodedInputStream found in modules protobuf-java-2.5.0.jar (com.google.protobuf:protobuf-java:2.5.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.CodedOutputStream found in modules protobuf-java-2.5.0.jar (com.google.protobuf:protobuf-java:2.5.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1)
Duplicate class com.google.protobuf.CodedOutputStream$OutOfSpaceException found in modules protobuf-java-2.5.0.jar (com.google.protobuf:protobuf-java:2.5.0) and protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1) ...
Go to the documentation to learn how to Fix dependency resolution errors.
最佳答案
作为修复,使用 gradle dependency
命令生成 gradle 依赖关系树,该树将向您显示从哪里获取 protobuf-lite-3.0.1.jar
和然后简单地使用 gradle 中的排除模式排除这个 jar,如下所示 -
dependencies {
compile('com.example.m:m:1.0') {
exclude group: 'org.unwanted', module: 'x
}
}
关于java - 添加 Firestore 时出现重复类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59610036/
我正在编写一个具有以下签名的 Java 方法。 void Logger(Method method, Object[] args); 如果一个方法(例如 ABC() )调用此方法 Logger,它应该
我是 Java 新手。 我的问题是我的 Java 程序找不到我试图用作的图像文件一个 JButton。 (目前这段代码什么也没做,因为我只是得到了想要的外观第一的)。这是我的主课 代码: packag
好的,今天我在接受采访,我已经编写 Java 代码多年了。采访中说“Java 垃圾收集是一个棘手的问题,我有几个 friend 一直在努力弄清楚。你在这方面做得怎么样?”。她是想骗我吗?还是我的一生都
我的 friend 给了我一个谜语让我解开。它是这样的: There are 100 people. Each one of them, in his turn, does the following
如果我将使用 Java 5 代码的应用程序编译成字节码,生成的 .class 文件是否能够在 Java 1.4 下运行? 如果后者可以工作并且我正在尝试在我的 Java 1.4 应用程序中使用 Jav
有关于why Java doesn't support unsigned types的问题以及一些关于处理无符号类型的问题。我做了一些搜索,似乎 Scala 也不支持无符号数据类型。限制是Java和S
我只是想知道在一个 java 版本中生成的字节码是否可以在其他 java 版本上运行 最佳答案 通常,字节码无需修改即可在 较新 版本的 Java 上运行。它不会在旧版本上运行,除非您使用特殊参数 (
我有一个关于在命令提示符下执行 java 程序的基本问题。 在某些机器上我们需要指定 -cp 。 (类路径)同时执行java程序 (test为java文件名与.class文件存在于同一目录下) jav
我已经阅读 StackOverflow 有一段时间了,现在我才鼓起勇气提出问题。我今年 20 岁,目前在我的家乡(罗马尼亚克卢日-纳波卡)就读 IT 大学。足以介绍:D。 基本上,我有一家提供簿记应用
我有 public JSONObject parseXML(String xml) { JSONObject jsonObject = XML.toJSONObject(xml); r
我已经在 Java 中实现了带有动态类型的简单解释语言。不幸的是我遇到了以下问题。测试时如下代码: def main() { def ks = Map[[1, 2]].keySet()
一直提示输入 1 到 10 的数字 - 结果应将 st、rd、th 和 nd 添加到数字中。编写一个程序,提示用户输入 1 到 10 之间的任意整数,然后以序数形式显示该整数并附加后缀。 public
我有这个 DownloadFile.java 并按预期下载该文件: import java.io.*; import java.net.URL; public class DownloadFile {
我想在 GUI 上添加延迟。我放置了 2 个 for 循环,然后重新绘制了一个标签,但这 2 个 for 循环一个接一个地执行,并且标签被重新绘制到最后一个。 我能做什么? for(int i=0;
我正在对对象 Student 的列表项进行一些测试,但是我更喜欢在 java 类对象中创建硬编码列表,然后从那里提取数据,而不是连接到数据库并在结果集中选择记录。然而,自从我这样做以来已经很长时间了,
我知道对象创建分为三个部分: 声明 实例化 初始化 classA{} classB extends classA{} classA obj = new classB(1,1); 实例化 它必须使用
我有兴趣使用 GPRS 构建车辆跟踪系统。但是,我有一些问题要问以前做过此操作的人: GPRS 是最好的技术吗?人们意识到任何问题吗? 我计划使用 Java/Java EE - 有更好的技术吗? 如果
我可以通过递归方法反转数组,例如:数组={1,2,3,4,5} 数组结果={5,4,3,2,1}但我的结果是相同的数组,我不知道为什么,请帮助我。 public class Recursion { p
有这样的标准方式吗? 包括 Java源代码-测试代码- Ant 或 Maven联合单元持续集成(可能是巡航控制)ClearCase 版本控制工具部署到应用服务器 最后我希望有一个自动构建和集成环境。
我什至不知道这是否可能,我非常怀疑它是否可能,但如果可以,您能告诉我怎么做吗?我只是想知道如何从打印机打印一些文本。 有什么想法吗? 最佳答案 这里有更简单的事情。 import javax.swin
我是一名优秀的程序员,十分优秀!