Im getting this issue after updating the project to Android X. I enable the Android X and Jetifier in gradle.properties:
android.useAndroidX=true
android.enableJetifier=true
and after I went to project, Refactor, and Migrate to AndroidX. After this, when I build the project it shows the following error:
warn: removing resource com.beatstars.mobile:string/com_facebook_loginview_logged_in_using_facebook_f1gender without required default value.
/Users/joaoluis/AndroidProjects/BeatStars/app/src/main/res/layout/fragment_player_collapsed.xml:2: error: attribute layoutDescription (aka com.beatstars.mobile:layoutDescription) not found.
/Users/joaoluis/AndroidProjects/BeatStars/app/src/main/res/layout/fragment_player_expanded.xml:2: error: attribute layoutDescription (aka com.beatstars.mobile:layoutDescription) not found.
/Users/joaoluis/AndroidProjects/BeatStars/app/src/main/res/xml/motion_player_swipe.xml:6: error: attribute constraintSetEnd (aka com.beatstars.mobile:constraintSetEnd) not found.
/Users/joaoluis/AndroidProjects/BeatStars/app/src/main/res/xml/motion_player_swipe.xml:6: error: attribute constraintSetStart (aka com.beatstars.mobile:constraintSetStart) not found.
error: failed linking file resources.
even this was working before. Anyone encounter this problem before?
This is my gradle file:
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.firebase.firebase-perf'
// Android Extensions
androidExtensions {
experimental = true
}
android {
compileSdkVersion targetSDK
buildToolsVersion buildToolsVersion
defaultConfig {
applicationId appID
minSdkVersion minSDK
targetSdkVersion targetSDK
versionName nameVersion
versionCode project.hasProperty('versionCode') ? project.property('versionCode') as int : codeVersion
// Instrumented Tests
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testHandleProfiling true
testFunctionalTest true
}
// Needed For Twitter SDK
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// Unit Test Options
testOptions {
reportDir "$rootDir/test-reports"
resultsDir "$rootDir/test-results"
unitTests.returnDefaultValues = true
unitTests.includeAndroidResources = true
}
// Keys Config
signingConfigs {
debug {
storeFile file(debugKeystoreProperties['storeFile'])
storePassword debugKeystoreProperties['storePassword']
keyAlias debugKeystoreProperties['keyAlias']
keyPassword debugKeystoreProperties['keyPassword']
}
release {
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
}
}
buildTypes {
// Debug
debug {
// OneSignal Manifest
manifestPlaceholders = [
onesignal_app_id: oneSignalAppIDDev,
onesignal_google_project_number: 'REMOTE'
]
// Other Settings
ext.enableCrashlytics = false
testCoverageEnabled true
signingConfig signingConfigs.debug
minifyEnabled false
}
// Dev Vars
dev {
// OneSignal Manifest
manifestPlaceholders = [
onesignal_app_id: oneSignalAppIDDev,
onesignal_google_project_number: 'REMOTE'
]
// Other Settings
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
testCoverageEnabled true
signingConfig signingConfigs.release
minifyEnabled false
}
// Stage
stage {
// OneSignal Manifest
manifestPlaceholders = [
onesignal_app_id: oneSignalAppIDDev,
onesignal_google_project_number: 'REMOTE'
]
// Other Settings
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
testCoverageEnabled true
signingConfig signingConfigs.release
minifyEnabled false
}
// Release
release {
// OneSignal Manifest
manifestPlaceholders = [
onesignal_app_id: oneSignalAppIDProd,
onesignal_google_project_number: 'REMOTE'
]
// Other Settings
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
testCoverageEnabled false
signingConfig signingConfigs.release
minifyEnabled false
debuggable false
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// Android Libs
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.media:media:1.0.1'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.palette:palette:1.0.0'
// Compute Colors most used in image
implementation 'com.google.android.material:material:1.0.0'
// Constrains Layouts
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
/** Tools **/
// Working with Texts Spans
implementation 'me.gujun.android:span:1.7'
// Image Picker and Editor
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
// Working with Smooth Transitions
implementation 'com.andkulikov:transitionseverywhere:1.8.1'
// Keyboard Listener
implementation 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'
// Crash Activity View
implementation 'cat.ereza:customactivityoncrash:2.2.0'
/** Widgets **/
// Fullscreen Loading
implementation 'com.airbnb.android:lottie:3.0.6'
// Fragments Bottom Tabs Navigation
implementation 'com.ncapdevi:frag-nav:2.4.0'
// Youtube View Player
implementation files('src/libs/YouTubeAndroidPlayerApi.jar')
// Horizontal Carousel
implementation 'com.yarolegovich:discrete-scrollview:1.4.9'
// Indicator for RecyclerViews
implementation 'com.kingfisherphuoc:easy-recyclerview-indicator:1.2'
// Image Badge
implementation 'com.github.nikartm:image-support:1.0.4'
// Button with Centered Images
implementation 'com.github.Omega-R:OmegaCenterIconButton:0.0.3@aar'
// CookieBar2, for Messages from Top and Bottom
implementation 'com.github.jobernas:CookieBar2:1.1.4' //master-SNAPSHOT
// Bubble Picker
implementation 'com.github.jobernas:Bubble-Picker:v0.2.6' //develop-SNAPSHOT
// Loader Fab Button
implementation 'com.mikhaellopez:circularprogressbar:2.0.0'
// Mentions Lib
implementation 'com.github.percolate:mentions:0.1.1'
// Sliding Panel for Player Container
implementation 'com.sothree.slidinguppanel:library:3.4.0'
// Photo Touch Working with version 1.2.7 (Not working in version 2.0.0)
implementation 'com.chensl.rotatephotoview:rotatephotoview:1.0.5'
// Several Adapters types for Recycler View
implementation 'com.beloo.widget:ChipsLayoutManager:0.3.7@aar'
implementation 'eu.davidea:flexible-adapter:5.0.6'
// implementation 'eu.davidea:flexible-adapter-ui:1.0.0'
// implementation 'eu.davidea:flexible-adapter-livedata:1.0.0-b3'
// implementation 'eu.davidea:flexible-adapter-databinding:1.0.0'
// Player
implementation "com.google.android.exoplayer:exoplayer-core:$exoPlayerVersion"
implementation "com.google.android.exoplayer:exoplayer-hls:$exoPlayerVersion"
implementation "com.google.android.exoplayer:extension-mediasession:$exoPlayerVersion"
// RX Kotlin
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxkotlin:2.2.0'
// Glide
implementation "com.github.bumptech.glide:glide:$glideVersion"
kapt "com.github.bumptech.glide:compiler:$glideVersion"
// Room Database
implementation 'androidx.room:room-runtime:2.0.0'
kapt 'androidx.room:room-compiler:2.0.0'
// API and Communication
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-moshi:$retrofitVersion"
implementation "nl.komponents.kovenant:kovenant:$kovenantVersion"
implementation "nl.komponents.kovenant:kovenant-ui:$kovenantVersion"
implementation "nl.komponents.kovenant:kovenant-rx:$kovenantVersion"
// Download and File Manager
implementation "com.liulishuo.okdownload:okdownload:$okDownloadVersion"
implementation "com.liulishuo.okdownload:sqlite:$okDownloadVersion"
implementation "com.liulishuo.okdownload:okhttp:$okDownloadVersion"
// Report Feedback Tool
implementation 'com.linkedin.shaky:shaky:1.1.1'
// Google Sign-In
implementation 'com.google.android.gms:play-services-auth:16.0.1'
// Facebook SDK
implementation "com.facebook.android:facebook-core:$facebookVersion"
implementation "com.facebook.android:facebook-login:$facebookVersion"
implementation "com.facebook.android:facebook-marketing:$facebookVersion"
// Twitter SDK
implementation('com.twitter.sdk.android:twitter:3.3.0@aar') {
transitive = true
}
// Sound Cloud SDK
implementation 'com.github.vpaliyX:SoundCloud-API:1.3.2'
// Other SDKs
// Ably SDK
implementation "io.ably:ably-android:$ablyVersion"
// One Signal SDK
implementation "com.onesignal:OneSignal:$oneSignalVersion"
// Firebase SDK
implementation "com.google.firebase:firebase-core:$firebaseCoreVersion"
implementation "com.google.firebase:firebase-perf:$firebasePerfVersion"
// Fabric and Crashlytics
implementation('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') {
transitive = true
}
// Lazy Loading helper for placeholders
implementation 'com.facebook.shimmer:shimmer:0.4.0'
// Debug Tools
implementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion"
implementation "com.squareup.leakcanary:leakcanary-support-fragment:$leakCanaryVersion"
implementation "com.facebook.stetho:stetho:$stethoVersion"
implementation "com.facebook.stetho:stetho-okhttp3:$stethoVersion"
implementation "com.facebook.stetho:stetho-js-rhino:$stethoVersion"
// Tests
testImplementation 'junit:junit:4.12'
testImplementation 'androidx.test:core:1.2.0'
testImplementation 'org.mockito:mockito-core:2.13.0'
testImplementation 'org.hamcrest:hamcrest-library:1.3'
// Android Instrumented Tests
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.annotation:annotation:1.1.0'
// Optional -- Hamcrest library
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
// Optional -- UI testing with Espresso
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// Optional -- UI testing with UI Automator
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
}
apply plugin: 'com.google.gms.google-services'
The Motion layout is declared like this:
<android.support.constraint.motion.MotionLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/containerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_mini_player"
app:layoutDescription="@xml/motion_player_swipe"
tools:showPaths="true">
And the Motion Scene:
<MotionScene
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<Transition
android:id="@+id/showUpTransition"
app:constraintSetStart="@layout/fragment_player_collapsed"
app:constraintSetEnd="@layout/fragment_player_expanded"
app:duration="150" />
</MotionScene>
2
Answers
I manage to fix the issue when I updated the library to the latest version
androidx.constraintlayout:constraintlayout
: from1.1.3
to2.0.0-beta1
this not because you migrate AndroidX, but there is showing error some field required default value which not mentioned and failed linking file resources show some resource not linked you may get specification line of error in log file