abu0306 / flutter_root_jailbreak

MIT License
5 stars 6 forks source link

Gradle plugin errors #2

Open Zaveri21 opened 1 year ago

Zaveri21 commented 1 year ago

I am getting error while adding this latest version package.

The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher.
The following dependencies do not satisfy the required version:
project ':flutter_root_jailbreak' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50

App level build gradle

buildscript {
    repositories {
        // ...
        //maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
        mavenCentral()
        google()
    }
    dependencies {
        // ...
        // OneSignal-Gradle-Plugin
        // classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.10, 0.99.99]'
        // classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.14.0, 0.99.99]'
        classpath 'com.android.tools.build:gradle:7.4.2'
    }
}

// apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
// apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

android {
    namespace "com.app.pacakgeName"
    compileSdkVersion 33
    ndkVersion "25.1.8937393"

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.app.packageName"
        minSdkVersion 21
        targetSdkVersion 33
        multiDexEnabled true
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        manifestPlaceholders = [
                onesignal_app_id: '*********',
                onesignal_google_project_number: 'REMOTE'
        ]
        ndkVersion "25.1.8937393"
        ndk {
            debugSymbolLevel 'FULL'
        }
    }

    signingConfigs {
        release {
            storeFile file("keystore/filepath.jks")
            storePassword "********"
            keyAlias "********"
            keyPassword "********"
        }
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            // signingConfig signingConfigs.debug
            signingConfig signingConfigs.release
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

        }
    }
    buildFeatures {
        aidl true
        buildConfig true
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    // implementation 'com.android.support:multidex:1.0.3'
    implementation "androidx.multidex:multidex:2.0.0"
    implementation 'androidx.work:work-runtime-ktx:2.7.0'
    implementation 'androidx.appcompat:appcompat:1.0.2'
}

apply plugin: 'com.google.gms.google-services'
android.buildTypes.release.ndk.debugSymbolLevel = 'FULL'`

Build.gradle

buildscript {
    ext.kotlin_version = '1.6.21'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.15'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://maven.google.com' }
    }
}

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

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}
Zaveri21 commented 1 year ago

hey @abu0306 thanks for this good plugin. i added to resolve my issue for upgraded Gradle & Kotlin version. just verify my PR.