gabrielemariotti / cardslib

Android Library to build a UI Card
4.66k stars 1.19k forks source link

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

Open AttilioCapocchiani opened 7 years ago

AttilioCapocchiani commented 7 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 5 years ago

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@ef39a99ef827802db488ad2203e742ca58053696

bluish5 commented 4 years ago

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

zeldomar commented 4 years ago

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 commented 4 years ago

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

ajburley commented 3 years ago

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:

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.