在移动设备和模拟器中运行应用程序都没有问题。但是在生成签名的APK时出现以下错误
Program type already present: android.support.v4.app.FragmentManagerImpl$1
Message{kind=ERROR, text=Program type already present: android.support.v4.app.FragmentManagerImpl$1, sources=[Unknown source file], tool name=Optional.of(D8)}
Module Gradle是
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "my.app"
minSdkVersion 16
targetSdkVersion 26
versionCode 3
versionName "2.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
useLibrary 'org.apache.http.legacy'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible,GradleCompatible
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
//noinspection GradleCompatible,GradleCompatible
implementation 'com.android.support:cardview-v7:21.+'
implementation 'com.github.JakeWharton:ViewPagerIndicator:2.4.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.yahoo.mobile.client.android.util.rangeseekbar:rangeseekbar-library:0.1.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'
implementation 'com.facebook.shimmer:shimmer:0.1.0@aar'
implementation 'net.cachapa.expandablelayout:expandablelayout:2.9.2'
implementation 'io.apptik.widget:multislider:1.3'
implementation 'com.google.firebase:firebase-messaging:17.3.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.code.gson:gson:2.8.1'
//implementation 'com.google.android.gms:play-services:6.5.87'
//implementation 'com.google.android.gms:play-services-gcm:11.0.4'
}
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:27.1.1'
}
apply plugin: 'com.google.gms.google-services'
Gradle项目是:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
//classpath 'com.google.gms:google-services:4.+'
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
mavenCentral()
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
答案 0 :(得分:0)
尝试使用此功能:
class Meta:
model = models.DepartmentData
fields = ['fid', 'dept_name']
data = []
#data.append((None, 'select one'))
data.append(('20', "---Choose One---"))
CHOICES = FacultyData.objects.all()
for v in CHOICES:
# fname = "%s -- $%d each" % (v.faculty_name, v.created_on)
data.append((v.id, v.faculty_name))
widgets = {
'fid': forms.Select(attrs={'class': 'form-control'}),
'dept_name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Enter Department Name'})
}
别忘了添加lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
。