Error while adding another table in room database - android

I already was using room database in my application. Now I have migrated my project to androidX, so dependencies are changed.
Now when I am adding a table and trying to run the project, I am getting an error for multiple files:
error: cannot find symbol class BR
Here is my model class:
#Keep
#Entity
public class Notification {
private String title;
private String body;
public Notification(String title, String body) {
this.title = title;
this.body = body;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
}
Here is my NotificationDao Class:
public abstract class NotificationDao {
#Insert(onConflict = REPLACE)
public abstract void insert(Notification notification);
#Query("DELETE FROM Notification")
public abstract void deleteAll();
}
Here is the code written for migration:
static final Migration MIGRATION_1_2 = new Migration(1, 2) {
#Override
public void migrate(SupportSQLiteDatabase database) {
database.execSQL("CREATE TABLE IF NOT EXISTS Notification (`title` TEXT, `body` TEXT)");
}
};
I have increased the version from 1 to 2.
I have added this in build as well.
Room.databaseBuilder(
application,
MyDatabase.class,
Configuration.DB_NAME
).addMigrations(MyDatabase.MIGRATION_1_2).build();
app.gradle is:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 29
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
versionCode 211990017
versionName "2.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// Write out the current schema of Room
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString(),]
}
}
vectorDrawables.useSupportLibrary = true
project.archivesBaseName = "xxxx";
multiDexEnabled true
externalNativeBuild {
cmake {
cppFlags "-std=c++11 -fexceptions"
arguments "-DANDROID_TOOLCHAIN=clang",
"-DANDROID_STL=c++_shared",
"-DANDROID_PLATFORM=android-21"
}
}
}
sourceSets {
main {
jniLibs.srcDirs = ['src/main/jniLibs']
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
signingConfigs {
release {
storeFile file("keystores/xxxx")
storePassword "xxxx"
keyAlias "xxxx"
keyPassword "xxxx"
}
}
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
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
proguardFiles fileTree(dir: "proguard", include: ["*.pro"]).asList().toArray()
proguardFiles getDefaultProguardFile('proguard-android.txt')
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
shrinkResources false
proguardFiles fileTree(dir: "proguard", include: ["*.pro"]).asList().toArray()
proguardFiles getDefaultProguardFile('proguard-android.txt')
signingConfig signingConfigs.release
}
}
dataBinding {
enabled true
}
buildToolsVersion '28.0.3'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions "environment"
productFlavors {
development {
applicationId "com.emproto.xxxx"
resValue "string", "content_provider", "com.xxx.xxxx.fileprovider"
}
production {
applicationId "com.xxxx"
resValue "string", "content_provider", "com.xxxx.fileprovider"
}
}
splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable true
// By default all ABIs are included, so use reset() and include to specify that we only
// want APKs for x86 and x86_64.
// Resets the list of ABIs that Gradle should create APKs for to none.
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include "x86", "x86_64", "arm64-v8a", "armeabi-v7a"
// Specifies that we do not want to also generate a universal APK that includes all ABIs.
universalApk true
}
}
}
ext.abiCodes = ['x86': 1, 'x86_64': 2, 'armeabi-v7a': 3, 'arm64-v8a': 4]
import com.android.build.OutputFile
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
def baseVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI))
if (baseVersionCode != null) {
output.versionCodeOverride = Integer.valueOf(baseVersionCode + variant.versionCode)
}
}
}
ext {
retrofitVersion = '2.3.0'
daggerVersion = '2.11'
supportLibVersion = '28.0.0'
googleLibVersion = '16.0.1'
frescoLibVersion = '2.0.0'
moEngageVersion = '9.8.02'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.exifinterface:exifinterface:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
/*Dagger 2 is a fully static and compile time dependency injection framework*/
implementation "com.google.dagger:dagger:$daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
implementation 'javax.annotation:jsr250-api:1.0'
/*LiveData and ViewModel*/
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
/*
annotationProcessor "android.arch.lifecycle:compiler:1.1.0"
*/
/*Room*/
implementation 'androidx.room:room-runtime:2.2.3'
annotationProcessor 'androidx.room:room-compiler:2.2.3'
// Java8 support for Lifecycles
implementation 'androidx.lifecycle:lifecycle-common-java8:2.2.0'
/*Retrofit*/
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
/*For loading images from network*/
implementation "com.facebook.fresco:fresco:$frescoLibVersion"
implementation "com.facebook.fresco:imagepipeline-okhttp3:$frescoLibVersion"
/*For the left menu*/
implementation 'com.yarolegovich:sliding-root-nav:1.1.0'
/*For the typing indicator*/
implementation 'com.github.channguyen:adv:1.0.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
/*For Graphs */
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
/*For firebase push notifications */
implementation "com.google.firebase:firebase-messaging:17.3.4"
implementation "com.google.firebase:firebase-core:16.0.6"
/*For Database debugging */
// debugImplementation 'com.amitshekhar.android:debug-db:1.0.4'
/*For S - Health */
implementation files('libs/s-health/samsung-health-data-v1.3.0.jar')
implementation files('libs/s-health/sdk-v1.0.0.jar')
/*For Google-Fit */
implementation "com.google.android.gms:play-services-fitness:$googleLibVersion"
implementation "com.google.android.gms:play-services-auth:$googleLibVersion"
/*Circular floating action bar*/
implementation 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
// For animated GIF support
implementation "com.facebook.fresco:animated-gif:$frescoLibVersion"
/*Circular seekbar - Feelings*/
implementation 'com.github.JesusM:HoloCircleSeekBar:v2.2.2'
/*Circular Layout - Feelings*/
implementation 'com.github.andreilisun:circular-layout:1.0'
/*For offline log synchronization*/
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
/*Wheel picker - RecordCholesterol*/
implementation 'com.weigan:loopView:0.1.2'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.3#aar') {
transitive = true;
}
/*Image Cropper - Profile Fragment*/
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
/*PDF Viewer - Prescription/Report */
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
api 'com.thedesigncycle.ui:views:0.3.1'
implementation 'com.ogaclejapan.smarttablayout:library:1.6.1#aar'
implementation 'com.getkeepsafe.taptargetview:taptargetview:1.11.0'
implementation files('libs/omron/jp.co.omron.healthcare.omoron_connect.wrapper-1.3.jar')
implementation 'com.appsee:appsee-android:+'
implementation 'com.github.florent37:viewtooltip:1.1.6'
implementation 'com.asksira.android:cameraviewplus:0.9.5'
implementation 'me.zhanghai.android.materialratingbar:library:1.3.1'
implementation 'com.priyankvex:smarttextview:1.0.1'
implementation 'com.github.flipkart-incubator:android-inline-youtube-view:1.0.3'
implementation 'com.github.varunest:sparkbutton:1.0.6'
implementation 'io.branch.sdk.android:library:3.2.0'
//foo transitions in trel home(doctor names)
implementation "com.andkulikov:transitionseverywhere:1.8.1"
//AppsFlyer
implementation 'com.appsflyer:af-android-sdk:4.10.3'
implementation 'com.android.installreferrer:installreferrer:1.0'
//picasso image loading lib
implementation 'com.squareup.picasso:picasso:2.5.2'
//Facebook analytics dependency
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
//Moengage dependency
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.moengage:moe-android-sdk:$moEngageVersion"
}
apply plugin: 'com.google.gms.google-services'
How can the error be fixed?

Not adding the primary key in model class was causing the problem. I think more specific error messages should be there from android studio's side regarding room database.

Related

Unable to generate release Build apk

I have a project with this build setting :
Project have separate debug variant
applicationIdSuffix '.debug'
versionNameSuffix '-DEBUG'
On the time of release, there are showing many build variants.
But I'm a beginner developer, so need to sure from you guys, which one is debug build variant that one I need to release?
Then what will do the other build variants?
And this project includes many modules ( like 3rd Party Sample Project )
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
//noinspection GradleDynamicVersion
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven {
url 'some url/'
credentials {
username 'someusername'
password 'somepassword'
}
}
}
// for Crashlytics
apply plugin: 'io.fabric'
// Create a variable called keystorePropertiesFile, and initialize it to your
// keystore.properties file, in the rootProject folder.
def keystorePropertiesFile = rootProject.file("keystore.properties")
// Initialize a new Properties() object called keystoreProperties.
def keystoreProperties = new Properties()
// Load your keystore.properties file into the keystoreProperties object.
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
// applicationVariants.all { variant ->
// //(variant.buildType.name == 'release') {
// variant.mergeAssetsProvider.configure {
// doLast {
// delete(fileTree(dir: outputDir, includes: ['**/*.pdf'])) // '**/js',
// }
// }
// //}
// }
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
lintOptions {
checkReleaseBuilds true
abortOnError true
//warningsAsErrors true
baseline file("lint-baseline.xml")
fatal 'StopShip'
}
compileSdkVersion 28
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.application.sanchyan"
versionName "3.1.8.4"
versionCode 18
targetSdkVersion 28
vectorDrawables.useSupportLibrary = true
renderscriptSupportModeEnabled true
renderscriptTargetApi 19
multiDexEnabled true
}
buildTypes {
debug {
applicationIdSuffix '.debug'
versionNameSuffix '-DEBUG'
//minifyEnabled true
// By using a special debug ProGuard file, you can turn off obfuscation, which would
// otherwise hinder debugging.
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro',
'proguard-rules-debug.pro'
}
release {
minifyEnabled true
//shrinkResources true
signingConfig signingConfigs.release
//multiDexKeepFile file('multidex-config.txt')
//proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
ext.enableCrashlytics = true
//
// IMPORTANT PART:
//
// tell your MultiDex to keep the classes you defined in your Proguard .pro file.
//multiDexKeepProguard file('proguard-rules.pro')
}
}
flavorDimensions "region", "mode", "api"
productFlavors {
// Read these to understand the whole concept better:
// li
// https://proandroiddev.com/advanced-android-flavors-part-1-building-white-label-apps-on-android-ade16af23bcf
// API
pre21 {
dimension "api"
minSdkVersion 19
versionNameSuffix ""
}
post21 {
dimension "api"
minSdkVersion 21
versionNameSuffix ""
}
// MODE
full {
dimension "mode"
}
demo {
dimension "mode"
applicationIdSuffix '.demo'
versionNameSuffix " [Demo]"
}
internal {
dimension "mode"
applicationIdSuffix '.internal'
versionNameSuffix " [Internal]"
}
// REGION
brigon {
dimension "region"
applicationIdSuffix '.brigon'
}
uei {
dimension "region"
applicationIdSuffix '.uei'
}
uk {
dimension "region"
versionNameSuffix ""
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation project(':polygonview')
implementation project(':tabbuttonview')
implementation project(':imagetoggleview')
implementation project(':wedgeview')
implementation project(':panzoomview')
implementation project(':flowlayout')
implementation project(':infoview')
implementation project(path: ':utilities')
implementation 'androidx.appcompat:appcompat:1.1.0' // 1.1.0-rc01
/* beta2 causes issues with layouts not showing content till updating (eg DevicePicker) */
//noinspection GradleDependency
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta3' // 2.0.0-beta1
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'cn.aigestudio.wheelpicker:WheelPicker:1.1.2'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.material:material:1.2.0-alpha02' // 1.1.0-alpha09
implementation 'com.google.firebase:firebase-core:17.2.1' // 17.0.0
implementation 'com.google.firebase:firebase-messaging:20.0.1'
implementation 'com.google.firebase:firebase-perf:19.0.2'
implementation 'com.google.maps.android:android-maps-utils:0.6.2'
implementation 'com.pacioianu.david:ink-page-indicator:1.3.0'
implementation 'com.squareup.moshi:moshi:1.9.2'
//noinspection GradleDependency
pre21Implementation 'com.squareup.okhttp3:okhttp:3.14.4'
post21Implementation 'com.squareup.okhttp3:okhttp:4.2.2'
//implementation 'com.squareup.okhttp3:okhttp:3.14.4'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'org.apache.commons:commons-text:1.8'
// for Crashlytics
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.crashlytics.sdk.android:answers:1.4.7'
// for PSPDFKit
implementation 'com.pspdfkit:pspdfkit:6.0.3'
implementation 'androidx.palette:palette:1.0.0'
// for Chrome web content
implementation 'com.android.support:customtabs:28.0.0'
// for image cropping
// implementation 'com.github.yalantis:ucrop:2.2.4-native'
implementation 'com.github.yalantis:ucrop:2.2.4'
// implementation 'com.androidplot:androidplot-core:0.9.4'
// Room components
// implementation "android.arch.persistence.room:runtime:$rootProject.roomVersion"
// annotationProcessor "android.arch.persistence.room:compiler:$rootProject.roomVersion"
// androidTestImplementation "android.arch.persistence.room:testing:$rootProject.roomVersion"
// Lifecycle components
implementation "android.arch.lifecycle:extensions:$rootProject.archLifecycleVersion"
//annotationProcessor "android.arch.lifecycle:compiler:$rootProject.archLifecycleVersion"
implementation "android.arch.lifecycle:common-java8:1.1.1"
testImplementation 'junit:junit:4.13-rc-2'
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.1'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
//noinspection GradlePath
implementation files('C:/Users/Dell/Documents/ProjectFilePath/libs/YouTubeAndroidPlayerApi.jar')
}
apply plugin: 'com.google.gms.google-services'
And the error shows on release build time is
Missing org.conscrypt.ConscryptHostnameVerifer
I don't know how much future error will come to release.
Please help me out
read this topic
And this one
While reading the info message, it gives me an idea about this Conscrypt and did a research and found out that I need to install conscrypt to my gradle.app
implementation 'org.conscrypt:conscrypt-android:2.2.1'
and it works.

Implementing uz.shift:colorpicker:0.5 in build.gradle

I imported the LeafPic project and I'm unable to sync the project. The error states that unable to resolve uz.shift:colorpicker:0.5. I searched for the web a lot and I couldn't find a solution.
build.gradle(:app)
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
repositories {
maven { url "https://dl.bintray.com/dasar/maven" }
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
maven { url "https://jitpack.io" }
mavenCentral()
}
android {
compileSdkVersion project.sdkVersion
defaultConfig {
applicationId "org.horaapps.leafpic"
minSdkVersion 19
targetSdkVersion project.sdkVersion
versionName "v0.7-alpha-2"
versionCode 16
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
lintOptions {
disable 'MissingTranslation'
disable 'ExtraTranslation'
abortOnError false
}
dexOptions {
jumboMode = true
}
// This is handled for you by the 2.0+ Gradle Plugin
aaptOptions {
additionalParameters "--no-version-vectors"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
signingConfigs {
release
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
resValue "string", "app_name", "LeafPic"
signingConfig signingConfigs.release
}
debug {
applicationIdSuffix ".debug"
resValue "string", "app_name", "LeafPic (debug)"
}
}
flavorDimensions "default"
productFlavors {
noGPlay {
dimension "default"
}
withGPlay {
dimension "default"
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//exifInterface
implementation "com.android.support:exifinterface:$supportVersion"
// google & support
implementation "com.android.support:appcompat-v7:$supportVersion"
implementation "com.android.support:cardview-v7:$supportVersion"
implementation "com.android.support:recyclerview-v7:$supportVersion"
implementation "com.android.support:design:$supportVersion"
implementation "com.android.support:palette-v7:$supportVersion"
implementation "com.android.support:customtabs:$supportVersion"
implementation "com.android.support:support-v4:$supportVersion"
//exo-player
implementation 'com.google.android.exoplayer:exoplayer-core:2.6.0'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.6.0'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.6.0'
implementation 'com.google.android.exoplayer:exoplayer-hls:2.6.0'
implementation 'com.google.android.exoplayer:exoplayer-smoothstreaming:2.6.0'
// utils
implementation 'com.github.bumptech.glide:glide:4.8.0'
//surumu 4.7.1 den 4.8.0 ya yukseltildi
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0' //surumu 4.7.1 den 4.8.0 ya yukseltildi
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.12'
implementation 'com.github.Commit451:bypasses:1.1.0'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.drewnoakes:metadata-extractor:2.11.0'
implementation "com.orhanobut:hawk:2.0.1"
implementation 'com.commonsware.cwac:provider:0.4.3'
// rxJava
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
//it is recommended to keep the same version of rxAndroid
implementation 'io.reactivex.rxjava2:rxjava:2.1.13'
// implementation 'com.jakewharton.rxrelay2:rxrelay:2.0.0'
// icons
implementation 'com.mikepenz:iconics-core:3.0.3#aar'
implementation "com.mikepenz:iconics-views:3.0.3#aar"
implementation 'com.mikepenz:google-material-typeface:3.0.1.2.original#aar'
implementation 'com.mikepenz:community-material-typeface:2.0.46.1#aar'
implementation 'com.mikepenz:fontawesome-typeface:4.7.0.2#aar'
// ui
implementation 'uz.shift:colorpicker:0.5#aar'
implementation 'com.github.jetradarmobile:desertplaceholder:1.1.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.github.yalantis:ucrop:2.2.2'
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0'
implementation 'jp.wasabeef:recyclerview-animators:2.2.7'
implementation 'com.github.HoraApps:Liz:-SNAPSHOT'
implementation 'com.github.lzyzsd:circleprogress:1.2.1'
// debug Only
//debugCompile project(':inappstoragereader')
implementation 'cat.ereza:customactivityoncrash:2.2.0'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.2' //1.5.4den 1.6.2 yeyukseltildi
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2' //1.5.4den 1.6.2 yeyukseltildi
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:multidex:1.0.3'
// TODO check them out
implementation 'com.turingtechnologies.materialscrollbar:lib:10.0.3'
implementation 'de.psdev.licensesdialog:licensesdialog:1.8.3'
}
Properties props = new Properties()
def propFile = new File('signing.properties')
if (propFile.canRead()) {
props.load(new FileInputStream(propFile))
if (props != null && props.containsKey('STORE_FILE') && props.containsKey('KEY_ALIAS') && props.containsKey('PASSWORD')) {
android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
android.signingConfigs.release.storePassword = props['PASSWORD']
android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
android.signingConfigs.release.keyPassword = props['PASSWORD']
} else {
println 'signing.properties found but some entries are missing'
android.buildTypes.release.signingConfig = null
}
} else {
println 'signing.properties not found'
android.buildTypes.release.signingConfig = null
}
Displayed error is:
Failed to resolve: uz:shiftcolorpicker:0.5
Show in Project Structure dialog
Affected Modules: app
recordnotfound.com states that the issue is 3 years old and it is still marked as an open issue.
A work around i found is to download the aar and import it as module.
You can download the aar from the github for the repository or click here
Then you can follow the procedure here to import the module
You should remove dependencies in both build.gradle relating to uz.shift:colorpicker:0.5
Don't forget to add the module/library to your dependency like this:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
........
implementation project(path: ':colorpicker-0.5')
........
}
Then sync your android studio project.
add in project level gradle file:
repositories {
maven {
url "http://dl.bintray.com/dasar/maven"
}
}
add in app(module) level gradle file:
implementation(group: 'uz.shift', name: 'colorpicker', version: '0.5', ext: 'aar')
Edit:
download the aar file from here and put it in libs folder:
https://bintray.com/dasar/maven/shiftcolorpicker/0.5
add this line in app gradle:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar'])
}
I got same issue in one of my older apps, seems like it doesn't work with gradle 6.5.
To solve this, I downloaded whole repo from github.
https://github.com/DASAR-zz/ShiftColorPicker
import shiftcolorpicker module in project and in gradle put :
implementation project(path: ':shiftcolorpicker')

Relase build getting crashed but debug is working fine

I am getting error of null in release build only. But when I am creating a release build it is getting crashed but working fine in debug mode.
When I was optimizing my apk i deleted mobile_navigation.xml file but it was never used anywhere
Here is my build file
//one signal integration
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.5'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
//end of one signal integration
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.codon.masterpiece"
minSdkVersion 17
targetSdkVersion 28
versionCode 110
versionName "4.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
manifestPlaceholders = [
onesignal_app_id : 'a33a085c-d32d-4462-a850-334f5c73db01',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'REMOTE'
]
}
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
}
buildTypes {
release {
minifyEnabled true
//shrinkResources true
//proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
res.srcDirs =
[
'src/main/res/layouts/home_and_fragments',
'src/main/res/layouts/login_and_onboarding',
'src/main/res/layouts',
'src/main/res'
]
}
}
buildToolsVersion '28.0.3'
compileOptions {
targetCompatibility = '1.8'
sourceCompatibility = '1.8'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.0.1'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.navigation:navigation-fragment:2.0.0'
implementation 'androidx.navigation:navigation-ui:2.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.exifinterface:exifinterface:1.0.0'
//addedd libraries due to conflict
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.browser:browser:1.0.0'
//card view
implementation 'androidx.cardview:cardview:1.0.0'
//Facebook sdk
implementation 'com.facebook.android:facebook-android-sdk:5.2.0'
//Google login
implementation 'com.google.android.gms:play-services-auth:17.0.0'
//Play Store core library
implementation 'com.google.android.play:core:1.6.1'
//Recyclerview
implementation 'androidx.recyclerview:recyclerview:1.0.0'
//Retrofit
// implementation('com.squareup.retrofit2:retrofit:2.6.1') {
// // exclude Retrofit’s OkHttp dependency module and define your own module import
// exclude module: 'okhttp'
// }
implementation 'com.squareup.retrofit2:retrofit:2.6.1'
// exclude Retrofit’s OkHttp dependency module and define your own module import
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.1'
implementation 'com.squareup.okhttp3:okhttp:3.12.1'
// implementation 'com.squareup.okhttp3:logging-interceptor:4.1.1'
// implementation 'com.squareup.okhttp3:okhttp:4.1.1'
//Volley
implementation 'com.android.volley:volley:1.1.1'
//circle image view
implementation 'de.hdodenhof:circleimageview:2.2.0'
//image crop library
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
//Picasso
implementation 'com.squareup.picasso:picasso:2.71828'
//currency and country picker
//implementation 'com.github.midorikocak:currency-picker-android:1.1.9'
//implementation 'com.github.yesterselga:country-picker-android:1.0'
//country picker
implementation 'com.github.mukeshsolanki:country-picker-android:2.0.1'
//imageview zoom
implementation 'com.github.chrisbanes:PhotoView:2.0.0'
//one signal
implementation 'com.onesignal:OneSignal:3.11.2'
//google analytics
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
//walkthrough
implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
//progressbar
//implementation 'com.bigkoo:svprogresshud:1.0.6'
//facebook shimmer effect
implementation 'com.facebook.shimmer:shimmer:0.4.0'
//progress bar
implementation 'com.kaopiz:kprogresshud:1.2.0'
}
Here is my logcat
Process: com.codon.masterpiece, PID: 13865
java.lang.NullPointerException: throw with null exception
at com.codon.masterpiece.d.b.b.a(Unknown Source:3)
at com.codon.masterpiece.ui.home.e$d.a(:341)
at f.g$b$a$a.run(:83)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6746)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Please suggest me what might be wrong in the release mode
Add SerializedName in every field of models which are used in the serialization process by Gson.
import com.google.gson.annotations.SerializedName;
public class Example {
#SerializedName("fieldName")//Add this line for all fields, the name passed in SerializedName should be a key in json
private String fieldName;
public String getFieldName() {
return fieldName;
}
public void setFieldName(String fieldName) {
this.fieldName = fieldName;
}
}
Or
You can keep that model in progaurd rule
-keep class com.codon.masterpiece.model.Example { *; }//use the package name and class name for the models

Program type already present: android.support.compat.R$attr

My project has two modules i.e. app and moduleX.
app project is mostly built on Java and moduleX is completly in Kotlin.
While creating "debug" build, it's running fine but when I try to create release build i.e. devRelease, it give following error-
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithDexMergerForDevRelease'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.compat.R$attr
Here is the app level build.gradle-
apply plugin: 'com.android.application'
apply plugin: 'com.facebook.testing.screenshot'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.appname"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner rootProject.ext.testInstrumentationRunner
}
flavorDimensions "environment"
productFlavors {
dev {
dimension "environment"
versionNameSuffix "-dev"
applicationIdSuffix ".dev"
}
qa {
dimension "environment"
versionNameSuffix "-test"
applicationIdSuffix ".test"
}
staging {
dimension "environment"
versionNameSuffix "-staging"
applicationIdSuffix ".staging"
}
prod {
dimension "environment"
}
}
signingConfigs {
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
release {
storeFile file("keystore/appname_keystore.jks")
storePassword properties.getProperty('storePassword')
keyAlias properties.getProperty('keyAlias')
keyPassword properties.getProperty('keyPassword')
}
}
buildTypes {
debug {
shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
bundle {
language {
enableSplit = false
}
}
configurations.all {
resolutionStrategy {
// force certain versions of dependencies (including transitive)
force 'com.squareup.okhttp3:okhttp:' + okHttpLibVersion
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//Unit testing
testImplementation rootProject.ext.junit
androidTestImplementation rootProject.ext.androidTestRunner
androidTestImplementation rootProject.ext.espresso
testImplementation rootProject.ext.mockito
testImplementation rootProject.ext.facebookScreenshotTestCommon
implementation rootProject.ext.facebookScreenshotTestLitho
androidTestImplementation rootProject.ext.supportTestRules
//Support Library & UI
implementation rootProject.ext.constraintLayout
implementation rootProject.ext.supportCompatV7
implementation rootProject.ext.supportDesign
implementation rootProject.ext.supportCardView
implementation rootProject.ext.supportCustomTabs
implementation rootProject.ext.glide
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
// Dagger dependency for DI
implementation 'com.google.dagger:dagger:2.16'
annotationProcessor "com.google.dagger:dagger-compiler:2.16"
compileOnly 'javax.annotation:jsr250-api:1.0'
implementation 'javax.inject:javax.inject:1'
// RxJava lib
implementation rootProject.ext.rxAndroid
implementation rootProject.ext.rxJava
implementation rootProject.ext.rxJavaRetrofitAdapter
//Retrofit
implementation(rootProject.ext.retrofit) {
exclude module: 'okhttp'
}
implementation rootProject.ext.okHttp
implementation rootProject.ext.okHttpLoggingInterceptor
implementation rootProject.ext.retrofitGsonConverter
implementation rootProject.ext.retrofitScalarsConverter
//Memory leaks
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.3'
//Others
implementation rootProject.ext.parceler
annotationProcessor rootProject.ext.parcelerAnnotationProcessor
implementation rootProject.ext.lombok
annotationProcessor rootProject.ext.lombokAnnotationProcessor
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
// Fingerprint Auth
implementation 'com.multidots:fingerprint-auth:1.0.1'
//Module Projects
api project(':energyswitchcui')
}
screenshots {
multipleDevices true
}
and here is the build.gradle file of moduleX-
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
// need separate runner for facebook screenshot test in module
testInstrumentationRunner 'com.appname.SnapshotTestRunner'
}
flavorDimensions "environment"
productFlavors {
dev {
dimension "environment"
}
qa {
dimension "environment"
}
staging {
dimension "environment"
}
prod {
dimension "environment"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
test.java.srcDirs += 'src/test/kotlin'
androidTest.java.srcDirs += 'src/androidTest/kotlin'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//Unit testing
testImplementation rootProject.ext.junit
androidTestImplementation rootProject.ext.androidTestRunner
androidTestImplementation rootProject.ext.espresso
testImplementation rootProject.ext.mockito
testImplementation rootProject.ext.facebookScreenshotTestCommon
implementation rootProject.ext.facebookScreenshotTestLitho
androidTestImplementation rootProject.ext.supportTestRules
//Support Library & UI
implementation rootProject.ext.constraintLayout
implementation rootProject.ext.supportCompatV7
implementation rootProject.ext.supportDesign
implementation rootProject.ext.supportCardView
implementation rootProject.ext.supportCustomTabs
implementation rootProject.ext.glide
implementation 'com.intuit.sdp:sdp-android:1.0.6'
// RxJava lib
implementation rootProject.ext.rxAndroid
implementation rootProject.ext.rxJava
implementation rootProject.ext.rxJavaRetrofitAdapter
//Retrofit
implementation(rootProject.ext.retrofit) {
exclude module: 'okhttp'
}
implementation rootProject.ext.okHttp
implementation rootProject.ext.okHttpLoggingInterceptor
implementation rootProject.ext.retrofitGsonConverter
implementation rootProject.ext.retrofitScalarsConverter
//Others
implementation rootProject.ext.parceler
kapt rootProject.ext.parcelerAnnotationProcessor
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
}
repositories {
mavenCentral()
}
// need for facebook screenshot test in module
apply plugin: 'com.facebook.testing.screenshot'
screenshots {
multipleDevices true
}
This is the project level build.gradle file-
apply from: 'dependencies.gradle'
buildscript {
ext.kotlinVersion = '1.3.30'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.facebook.testing.screenshot:plugin:0.8.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is dependencies.gradle-
ext {
//Android
minSdkVersion = 24
targetSdkVersion = 28
compileSdkVersion = targetSdkVersion
testInstrumentationRunner = "com.appname.runner.SnapshotTestRunner"
androidSupportLibVersion = "28.0.0"
okHttpLibVersion = "3.14.0"
//Unit testing
junit = "junit:junit:4.12"
androidTestRunner = "com.android.support.test:runner:1.0.2"
espresso = "com.android.support.test.espresso:espresso-core:3.0.2"
mockito = "org.mockito:mockito-all:1.10.19"
facebookScreenshotTestCommon = "com.facebook.testing.screenshot:layout-hierarchy-common:0.8.0"
facebookScreenshotTestLitho = "com.facebook.testing.screenshot:layout-hierarchy-litho:0.8.0"
supportTestRules = "com.android.support.test:rules:1.0.2"
//Support Library & UI
constraintLayout = "com.android.support.constraint:constraint-layout:1.1.3"
supportCompatV7 = "com.android.support:appcompat-v7:$androidSupportLibVersion"
supportDesign = "com.android.support:design:$androidSupportLibVersion"
supportCardView = "com.android.support:cardview-v7:$androidSupportLibVersion"
supportCustomTabs = "com.android.support:customtabs:$androidSupportLibVersion"
glide = "com.github.bumptech.glide:glide:3.7.0"
// RxJava lib
rxAndroid = "io.reactivex.rxjava2:rxandroid:2.0.1"
rxJava = "io.reactivex.rxjava2:rxjava:2.1.8"
rxJavaRetrofitAdapter = "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0"
//Retrofit
retrofit = "com.squareup.retrofit2:retrofit:2.4.0"
okHttp = "com.squareup.okhttp3:okhttp:$okHttpLibVersion"
okHttpLoggingInterceptor = "com.squareup.okhttp3:logging-interceptor:$okHttpLibVersion"
retrofitGsonConverter = "com.squareup.retrofit2:converter-gson:2.3.0"
retrofitScalarsConverter = "com.squareup.retrofit2:converter-scalars:2.3.0"
//Others
parceler = "org.parceler:parceler-api:1.1.6"
parcelerAnnotationProcessor = "org.parceler:parceler:1.1.6"
lombok = "org.projectlombok:lombok:1.16.16"
lombokAnnotationProcessor = "org.projectlombok:lombok:1.16.16"
}
I have already tried many answers i.e.
Error : Program type already present: android.support.design.widget.CoordinatorLayout$Behavior
but nothing is working here.
Hi i have come up with the solution and run successful below gradles with just little version changes:
Main Project Level Gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.30'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.facebook.testing.screenshot:plugin:0.8.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
//Android
minSdkVersion = 24
targetSdkVersion = 28
compileSdkVersion = targetSdkVersion
testInstrumentationRunner = "com.appname.runner.SnapshotTestRunner"
androidSupportLibVersion = "28.0.0"
androidCompatVersion = "1.0.0-beta01"
androidCardViewVersion = "1.0.0"
constraintlayoutVersion = "1.1.3"
okHttpLibVersion = "3.14.0"
//Unit testing
junit = "junit:junit:4.12"
androidTestRunner = "androidx.test:runner:1.1.0-alpha4"
espresso = "androidx.test.espresso:espresso-core:3.1.0-alpha4"
supportTestRules = "com.android.support.test:rules:1.0.2"
//Support Library & UI
constraintLayout = "androidx.constraintlayout:constraintlayout:$constraintlayoutVersion"
supportCompatV7 = "androidx.appcompat:appcompat:$androidCompatVersion"
supportDesign = "com.android.support:design:$androidSupportLibVersion"
supportCardView = "androidx.cardview:cardview:$androidCardViewVersion"
supportCustomTabs = "com.android.support:customtabs:$androidSupportLibVersion"
glide = "com.github.bumptech.glide:glide:3.7.0"
mockito = "org.mockito:mockito-all:1.10.19"
facebookScreenshotTestCommon = "com.facebook.testing.screenshot:layout-hierarchy-common:0.8.0"
facebookScreenshotTestLitho = "com.facebook.testing.screenshot:layout-hierarchy-litho:0.8.0"
// RxJava lib
rxAndroid = "io.reactivex.rxjava2:rxandroid:2.0.1"
rxJava = "io.reactivex.rxjava2:rxjava:2.1.8"
rxJavaRetrofitAdapter = "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0"
//Retrofit
retrofit = "com.squareup.retrofit2:retrofit:2.4.0"
okHttp = "com.squareup.okhttp3:okhttp:$okHttpLibVersion"
okHttpLoggingInterceptor = "com.squareup.okhttp3:logging-interceptor:$okHttpLibVersion"
retrofitGsonConverter = "com.squareup.retrofit2:converter-gson:2.3.0"
retrofitScalarsConverter = "com.squareup.retrofit2:converter-scalars:2.3.0"
//Others
parceler = "org.parceler:parceler-api:1.1.9"
parcelerAnnotationProcessor = "org.parceler:parceler:1.1.9"
lombok = "org.projectlombok:lombok:1.16.16"
lombokAnnotationProcessor = "org.projectlombok:lombok:1.16.16"
}
App Level gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.example.gradletest"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation rootProject.ext.junit
androidTestImplementation rootProject.ext.androidTestRunner
androidTestImplementation rootProject.ext.espresso
androidTestImplementation rootProject.ext.supportTestRules
testImplementation rootProject.ext.mockito
testImplementation rootProject.ext.facebookScreenshotTestCommon
implementation rootProject.ext.facebookScreenshotTestLitho
implementation rootProject.ext.constraintLayout
implementation rootProject.ext.supportCompatV7
implementation rootProject.ext.supportDesign
implementation rootProject.ext.supportCardView
implementation rootProject.ext.supportCustomTabs
implementation rootProject.ext.glide
// RxJava lib
implementation rootProject.ext.rxAndroid
implementation rootProject.ext.rxJava
implementation rootProject.ext.rxJavaRetrofitAdapter
//Retrofit
implementation(rootProject.ext.retrofit) {
exclude module: 'okhttp'
}
implementation rootProject.ext.okHttp
implementation rootProject.ext.okHttpLoggingInterceptor
implementation rootProject.ext.retrofitGsonConverter
implementation rootProject.ext.retrofitScalarsConverter
implementation rootProject.ext.parceler
// annotationProcessor rootProject.ext.parcelerAnnotationProcessor
implementation rootProject.ext.lombok
annotationProcessor rootProject.ext.lombokAnnotationProcessor
//Memory leaks
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.3'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.multidots:fingerprint-auth:1.0.1'
implementation project(':energyswitchcui')
}
Module("energyswitchcui") gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//Unit testing
testImplementation rootProject.ext.junit
androidTestImplementation rootProject.ext.androidTestRunner
androidTestImplementation rootProject.ext.espresso
testImplementation rootProject.ext.mockito
testImplementation rootProject.ext.facebookScreenshotTestCommon
implementation rootProject.ext.facebookScreenshotTestLitho
androidTestImplementation rootProject.ext.supportTestRules
//Support Library & UI
implementation rootProject.ext.constraintLayout
implementation rootProject.ext.supportCompatV7
implementation rootProject.ext.supportDesign
implementation rootProject.ext.supportCardView
implementation rootProject.ext.supportCustomTabs
implementation rootProject.ext.glide
implementation 'com.intuit.sdp:sdp-android:1.0.6'
// RxJava lib
implementation rootProject.ext.rxAndroid
implementation rootProject.ext.rxJava
implementation rootProject.ext.rxJavaRetrofitAdapter
//Retrofit
implementation(rootProject.ext.retrofit) {
exclude module: 'okhttp'
}
implementation rootProject.ext.okHttp
implementation rootProject.ext.okHttpLoggingInterceptor
implementation rootProject.ext.retrofitGsonConverter
implementation rootProject.ext.retrofitScalarsConverter
//Others
implementation rootProject.ext.parceler
// kapt rootProject.ext.parcelerAnnotationProcessor
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
repositories {
mavenCentral()
}
// need for facebook screenshot test in module
apply plugin: 'com.facebook.testing.screenshot'
screenshots {
multipleDevices true
}
Below are the errors that were encountered during gradle and what i have done to solve it:
1) Error: Invoke-customs are only supported starting with Android O (--min-api 26)
Solution: put below lines under android section of app level gradle
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
2) Error: The given artifact contains a string literal with a package reference 'android.support.v4.widget' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.
Solution: Removed "annotationProcessor rootProject.ext.parcelerAnnotationProcessor" from app level gradle and updated this library in main level gradle under "ext" section from 1.1.6 to 1.1.9 'parcelerAnnotationProcessor = "org.parceler:parceler:1.1.9"'
but it does not worked
So i removed that library and successfully build gradle and also can run the project. Here is the dropbox link you can find project on :https://www.dropbox.com/s/ki8gpfdaxh0dzo3/GradleTest.zip?dl=0
3) Above solution will work only in debug mode but in release build we have to also remove this two libraries to build successfully in release build:
facebookScreenshotTestCommon = "com.facebook.testing.screenshot:layout-hierarchy-common:0.9.0"
facebookScreenshotTestLitho = "com.facebook.testing.screenshot:layout-hierarchy-litho:0.9.0"

Incorrectly typed data found for annotation element public abstract int[] butterknife.OnClick.value()

I was following an Android tutorial; here is my previous error I faced while following the tutorial.
As I reached almost the end of the tutorial, I got the following error:
Caused by: java.lang.annotation.AnnotationTypeMismatchException: Incorrectly typed data found for annotation element public abstract int[] butterknife.OnClick.value() (Found data of type int[])
I don't know what I say more about it, so I will paste the app Gradle file here:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
android.applicationVariants.all { variant ->
variant.outputs.all { output ->
def fileName = "${project.name}_${output.baseName}-${variant.versionName}.apk"
outputFileName = new File(output.outputFile.parent, fileName).getName()
}
}
lintOptions {
abortOnError false
}
defaultConfig {
applicationId "com.tomsapp.mulberry"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0.0"
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(path: ':licensing')
implementation('com.github.afollestad.material-dialogs:core:0.8.5.3#aar') {
transitive = true
}
implementation('com.github.afollestad:drag-select-recyclerview:0.3.1#aar') {
transitive = true
}
implementation 'com.github.afollestad:bridge:3.1.1'
implementation 'com.github.afollestad:sectioned-recyclerview:0.2.0'
implementation 'com.github.afollestad:assent:0.2.0'
implementation 'com.github.afollestad:inquiry:2.0.1'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:23.1.1'
implementation 'com.android.support:recyclerview-v7:23.1.1'
implementation 'com.android.support:support-v4:23.1.1'
implementation 'com.android.support:design:23.1.1'
implementation 'com.android.support:cardview-v7:23.1.1'
implementation 'com.android.support:palette-v7:23.1.1'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.github.florent37:glidepalette:1.0.6#aar'
implementation 'com.jakewharton:butterknife:7.0.1'
implementation 'com.google.android.apps.muzei:muzei-api:2.0'
implementation 'com.makeramen:roundedimageview:2.2.1'
}
I referred this link for a solution, but the mentioned solutions in it created new errors in my code - ButterKnife 8.0.1 not working

Categories

Resources