1

I did the "Write your first Flutter app, Part 1".

There are instructions on how to do this for Java projects, but this is using Flutter and I have tried the other solutions but it does not work.

In the Project->External Libraries I have these 3 Libraries:

  1. Dart Packages
  2. Dart SDK
  3. Flutter for Android

Is there a way to generate .jar for a Project that has 3 libraries?

Here is the current build.gradle

buildscript {
    ext.kotlin_version = '1.2.30'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

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

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

I am using AD 3.2.1

SpeedyVV
  • 139
  • 10
  • Possible duplicate of [How to make a .jar out from an Android Studio project](https://stackoverflow.com/questions/21712714/how-to-make-a-jar-out-from-an-android-studio-project) – Abhinav Nov 08 '18 at 16:52
  • @Abhinav, thanks for you suggestion. However I had seen it before and tried it, but it did not work.... build errors. This might have something to do that this is specific to Flutter "builds". – SpeedyVV Nov 08 '18 at 21:26
  • Build errors? What are those errors? Can you please post them in the question so that we can have better understanding of your problem? – Abhinav Nov 09 '18 at 02:19

1 Answers1

0

I'm confused with your question if you're asking how to add a jar library to the Flutter project or if you're trying to generate a jar from the Flutter project.

If you're trying to add a jar library, you can add one by navigating through File > Project Structure > Libraries. Then click on the Add (+) button, and select Java. This should open up the Directory and select the desired jar file.

Adding jar

Otherwise, you can follow this guide to create a jar from the Android project. You can navigate to the Flutter project's Android build on Tools > Flutter > Open Android module in Android Studio

Omatt
  • 8,564
  • 2
  • 42
  • 144