Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

support kotlin in android studio ? Three are many errors in my project if I use kotlin. For example: #2003

Description

@zhouwenhao

support kotlin in android studio ? Three are many errors in my project if I use kotlin. For example:
Unresolved refrence: xxxx_

Activity

  1. WonderCsabo commented on May 22, 2017

    @WonderCsabo
    Member

    We already have Kotlin support. What errors do you have?

  2. zhouwenhao commented on May 22, 2017

    @zhouwenhao
    Author

    Like this: Unresolved refrence: LoginActivity_

  3. dodgex commented on May 22, 2017

    @dodgex
    Member

    have you properly set up your project? have a look at the build.gradle in the sample @WonderCsabo has linked. Look for usage kapt.

  4. nemesis06101986 commented on May 24, 2017

    @nemesis06101986

    Hi guys, I'm having a similar issue. I've configured my build.graddle acording to the build.graddle in the example project you've linked. But I'm receiving this when building:

    Error:(22, 0) Could not get unknown property 'processResourcesTask' for ApkVariantOutputImpl_Decorated{apkData=Main{type=MAIN, fullName=debug, filters=[]}} of type com.android.build.gradle.internal.api.ApkVariantOutputImpl.

    This is my build.gradle

    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-kapt'
    
    android {
        compileSdkVersion 25
        buildToolsVersion "25.0.2"
        defaultConfig {
            applicationId "com.asillybug.fredagsskamtet"
            minSdkVersion 19
            targetSdkVersion 25
            versionCode 1
            versionName "1.0"
        }
        sourceSets {
            main.java.srcDirs += "src/main/kotlin"
        }
    }
    
    kapt {
        arguments {
            arg("androidManifestFile", variant.outputs[0].processResourcesTask.manifestFile)
        }
    }
    
    def AAVersion = "4.3.0"
    
    dependencies {
        compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
        compile 'com.android.support:appcompat-v7:25.3.1'
        compile 'com.android.support.constraint:constraint-layout:1.0.2'
    
        kapt "org.androidannotations:androidannotations:$AAVersion"
        compile "org.androidannotations:androidannotations-api:$AAVersion"
    }
    
    
  5. dodgex commented on May 24, 2017

    @dodgex
    Member

    @nemesis06101986 to resolve your issue remove the kapt {} block. but when you are using the latest 3.0 android plugin you might get an error that AA can not find the AndroidManifest.xml... for that error i already opened a PR to fix it.

  6. nemesis06101986 commented on May 24, 2017

    @nemesis06101986

    Thanks @dodgex . That was actually my problem, and the reason why I added the kapt{} block.

    I'll wait for an update on this then. Thanks for the info

  7. WonderCsabo commented on Jun 7, 2017

    @WonderCsabo
    Member

    This issue is fixed. You can try it in the snapshot release.

  8. carloxavier commented on Jul 31, 2017

    @carloxavier

    @WonderCsabo how can we try the snapshot release?

  9. WonderCsabo commented on Jul 31, 2017

    @WonderCsabo
    Member
  10. sattha commented on Oct 21, 2017

    @sattha

    here is my config, to make it work

    kapt {
        arguments {
            arg("resourcePackageName", android.defaultConfig.applicationId)
            arg("androidManifestFile", variant.outputs[0]?.processResources?.manifestFile)
        }
    }
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

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