M. Plant
M. Plant

Reputation: 493

implement external library android in flutter plugin

i try to implementation an android external library in flutter plugin let's called myPlugin. But i have no idea how to build build.gradle which has implementation of external library. i tried run main project that depend on myplugin. but still i cannot call any api of external library here's myplugin build.gradle :

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}

rootProject.allprojects {
    repositories {
        google()
        jcenter()
    }
}

apply plugin: 'com.android.library'

android {
    compileSdkVersion 27

    defaultConfig {
        minSdkVersion 16
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    lintOptions {
        disable 'InvalidPackage'
    }
}
dependencies {
    implementation 'com.android.support:support-v4:26.1.0'
}

when i try to import android.support.v4...ActivityCompat, it's called cannot resolve symbol. please tell me how to do the right way. thanks

Upvotes: 1

Views: 3986

Answers (2)

M. Plant
M. Plant

Reputation: 493

Thanks. i solve it .

Open in android studio Project/android and wrapping with gradle.

thanks

Upvotes: -2

boformer
boformer

Reputation: 30103

There are 2 build.gradle files.

  • The one in your android folder is the project-level build.gradle. You usually do not edit it.
  • The one in your android/app folder is the app/module-level build.gradle. Place your dependencies in this file.

Upvotes: 6

Related Questions