Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library seems not to work with Android Studio 3 preview #564

Open
AttilioCapocchiani opened this issue Sep 10, 2017 · 7 comments
Open

Library seems not to work with Android Studio 3 preview #564

AttilioCapocchiani opened this issue Sep 10, 2017 · 7 comments

Comments

@AttilioCapocchiani
Copy link

Good morning,
putting the dependencies lines on gradle, give me the following error resource android:attr/foregroundInsidePadding is private. Isn't the library compatible with AS 3.0 preview?

@felipeslongo
Copy link

felipeslongo commented Jan 12, 2018

Good afternoon.

I have this problem as well, looking thru the Internet people suggested a workaround that worked.
I don't know the consequences thou.
Check this link:

cardslib error resource android:attr/foregroundInsidePadding is private while targeting SDK 26

From the contributor that suggested the solution

Try disabling the AAPT2 by adding android.enableAapt2=false to your gradle.properties file.

Builds may fail while AAPT2 is enabled. Additionally, AAPT2 is currently not compatible with Robelectric. If your build fails due to an AAPT2 resource processing issue or you want to use Roboelectric, you can disable AAPT2 by setting android.enableAapt2=false in your gradle.properties file and restarting the Gradle daemon by running ./gradlew --stop from the command line.

Reference : here

I was using Android studio 3.0 beta 5 In which I disabled the AAPT2 and it resolved my error.

@IlyaChizhanov
Copy link

I have Same problem.

dependencies {
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    compile 'com.github.gabrielemariotti.cards:library:1.9.1'
}

.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.0.aar/0587eeae883e3b2b6fdee97d0b2dd9e3/res/values/values.xml
Error:(251, 5) error: resource android:attr/foregroundInsidePadding is private.

.../android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml
Error:(467) resource android:attr/foregroundInsidePadding is private.

@ajburley
Copy link

enableAapt2 was removed from the later versions of Android Studio / Gradle plugin. It's ignored, so AAPT2 is always used regardless of this option.

There is no official patch but this patch is helpful: oplarshad/cardslib@ef39a99

@bluish5
Copy link

bluish5 commented Dec 3, 2019

Hello @ajburley, I'm new to GIT. How can I add oplarshad's fork of cardslib to my Android Studio project? Thank you!

@zeldomar
Copy link

Hello @ajburley, I'm new to GIT. How can I add oplarshad's fork of cardslib to my Android Studio project? Thank you!

Hello bluish5,

Did you finally find a solution for adding oplarshad's fork of cardslib to your Android Studio project?

Thank you !

@bluish5
Copy link

bluish5 commented Jun 17, 2020

No, I downgraded to a previous version of Android Studio...

@ajburley
Copy link

ajburley commented Jan 18, 2021

I just manually applied the diffs from that patch to my local copy of vanilla cardslib. The changes are to fix the compiler errors which you get with AAPT2. This will allow the project to build with AAPT2.

Also, not all the changes from that commit are even required. Lots of the changes are actually to remove redundant code, which is a good thing, but not essential for this task of making it work with AAPT2.

Changed files where the changes are NOT only to remove redundant code are:

  • /build.gradle
  • /demo/extras/build.gradle
  • /demo/stock/build.gradle
  • /extra/extra-dragdrop/build.gradle
  • /extra/extra-staggeredgrid/build.gradle
  • /extra/extra-twoway/build.gradle
  • /gradle/wrapper/gradle-wrapper.properties
  • /library-cards/build.gradle
  • /library-core/build.gradle
  • /library-core/src/main/AndroidManifest.xml
  • /library-core/src/main/java/it/gmariotti/cardslib/library/view/ForegroundLinearLayout.java
  • /library-core/src/main/res/values/attrs.xml
  • /library-recyclerview/build.gradle

The key changes are ForegroundLinearLayout.java and attrs.xml. The others are just to upgrade various versions.

Personally, I tried downgrading Android Studio to 3.0.x, but it didn't work, because on first launch it still downloaded the latest version of the SDK. It is the SDK, and not Android Studio itself, that enforce the AAPT2 usage. So that's why I had to change the code to get it working with AAPT2, and that's where oplarshad's code came in handy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants