Skip to content

Xtend + Android support library = error: cannot access DrawerLayoutImpl #32

Closed
@tobykurien

Description

This error happens the first time you build a project that uses the Android support library. To reproduce, try cloning WebApps (https://github.com/tobykurien/webapps) and building by running gradle assembleRelease:

:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:preReleaseBuild UP-TO-DATE
:prepareComAndroidSupportAppcompatV72221Library
:prepareComAndroidSupportSupportV42221Library
:prepareComGithubTobykurienXtendroid0121Library
:prepareDebugDependencies
:compileDebugAidl
:compileDebugRenderscript
:generateDebugBuildConfig
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets
:generateDebugResValues UP-TO-DATE
:generateDebugResources
:mergeDebugResources
:processDebugManifest
:processDebugResources
:compileDebugXtend
[snip - warnings]
:generateDebugSources
:processDebugJavaRes UP-TO-DATE
:compileDebugJava
/WebApps/src/com/tobykurien/webapps/activity/BaseWebAppActivity.java:35: error: cannot access DrawerLayoutImpl
public class BaseWebAppActivity extends AppCompatActivity {
...

The error only happens the first time (i.e. no build directory), thereafter it compiles fine. Unfortunately, this means that Travis CI builds fail. Happens with Gradle 2.2.1 and even Gradle 2.5.

One way to make this build pass the first time is to extract the JAR file containing the class (i.e. build/intermediates/exploded-aar/com.android.support/support-v4/22.2.1/jars/libs/internal_impl-22.2.1.jar and copy it into a libs folder and include that in the gradle dependencies. This is not ideal (and means my app isn't accepted by FDroid).

Also seems to affect Kotlin (https://devnet.jetbrains.com/message/5538844) and Groovy (groovy/groovy-android-gradle-plugin#31) and Maven (simpligility/android-maven-plugin#621) though there seem to be different work-arounds there.

Could you please look into why this might be happening? Any workarounds without including a binary jar file?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions