Flutter : Getting appcenter:verifyReleaseResources Error When Trying to Build in AppCenter - android

I have followed this blog to build my app on AppCenter
Exactly did the same process
https://medium.com/#maite.daluz11/deploy-flutter-apps-using-appcenter-ec28e8d940bf
APPCENTER BUILD OUTPUT IS SHOWING
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':appcenter:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/Users/runner/.gradle/caches/transforms-2/files-2.1/a528b13ac93e64cafa3d0480e2c93207/core 1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.
/Users/runner/.gradle/caches/transforms-2/files-2.1/a528b13ac93e64cafa3d0480e2c93207/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/ttcIndex not found.
BUILD FAILED in 2m 16s
Running Gradle task 'assembleRelease'... 137.7s (!)
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
✏️ Creating `android/settings_aar.gradle`... 1ms
✓ `android/settings_aar.gradle` created successfully.
Building plugin appcenter...
Running Gradle task 'assembleAarRelease'... 35.1s
✓ Built build/app/outputs/repo.
Building plugin appcenter_analytics...
Running Gradle task 'assembleAarRelease'... 2.7s
✓ Built build/app/outputs/repo.
Building plugin appcenter_crashes...
Running Gradle task 'assembleAarRelease'... 2.4s
✓ Built build/app/outputs/repo.
Building plugin flutter_plugin_android_lifecycle...
Running Gradle task 'assembleAarRelease'... 20.9s
Gradle 5.4.1
Resolved com.android.tools.build:gradle:3.5.0 in :classpath
Resolved androidx.annotation:annotation:1.1.0 in :releaseRuntimeClasspath
Resolved io.flutter:flutter_embedding_release:1.0.0-ae90085a8437c0ae94d6b5ad2741739ebc742cb4 in :releaseCompileClasspath
Resolved androidx.annotation:annotation:1.1.0 in :releaseCompileClasspath
Resolved androidx.annotation:annotation:1.1.0 in :releaseCompileClasspath
Resolved com.android.tools.lint:lint-gradle:26.5.0 in :lintClassPath
/Users/runner/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.11/android/src/main/java/io/flutter/embedding/engine/plugins/lifecycle/FlutterLifecycleAdapter.java:8: error: package androidx.lifecycle does not exist
import androidx.lifecycle.Lifecycle;
^
/Users/runner/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.11/android/src/main/java/io/flutter/embedding/engine/plugins/lifecycle/FlutterLifecycleAdapter.java:22: error: cannot find symbol
public static Lifecycle getActivityLifecycle(
^
symbol: class Lifecycle
location: class FlutterLifecycleAdapter
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
BUILD FAILED in 18s
The plugin flutter_plugin_android_lifecycle could not be built due to the issue above.
My android/app/build.gradle is:
android {
compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.flutter_tls_identity"
minSdkVersion 21
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
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
}
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
def appCenterSdkVersion = '4.0.0'
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
}
My android/build.gradle is:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
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
}
My android/app/appcenter-post-clone.sh is:
#!/usr/bin/env bash
#Place this script in project/android/app/
cd ..
#fail if any command fails
set -e
#debug log
set -x
cd ..
git clone -b beta https://github.com/flutter/flutter.git
export PATH=`pwd`/flutter/bin:$PATH
flutter channel stable
flutter doctor
echo "Installed flutter to `pwd`/flutter"
#build APK
#if you get "Execution failed for task ':app:lintVitalRelease'." error, uncomment next two lines
#flutter build apk --debug
#flutter build apk --profile
flutter build apk --release
#if you need build bundle (AAB) in addition to your APK, uncomment line below and last line of this script.
#flutter build appbundle --release --build-number $APPCENTER_BUILD_ID
#copy the APK where AppCenter will find it
mkdir -p android/app/build/outputs/apk/; mv build/app/outputs/apk/release/app-release.apk $_
#copy the AAB where AppCenter will find it
#mkdir -p android/app/build/outputs/bundle/; mv build/app/outputs/bundle/release/app-release.aab $_
My gradle.properties is
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
My pubspec.yaml dependencies is
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
path_provider:
image_picker:
appcenter:
appcenter_analytics:
appcenter_crashes:
My gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip

Solution to the error is;
1 - Open your android/build.gradle & add the following code under your last subprojects
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 28 --> This is the version in my android/app/build.gradle
buildToolsVersion "28.0.3"
}
}
}
}
2 - Right click to the android[flutter_app_name] folder & go to Flutter -> Open Android module in Android Studio
3 - Under your Project folder open android -> android [appcenter] -> build.gradle & make sure the following Versions are same with the one's in your android/app/build.gradle
compileSdkVersion
buildToolsVersion
minSdkVersion
targetSdkVersion
group 'com.aloisdeniel.flutter.appcenter'
version '1.0-SNAPSHOT'
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
}
}
rootProject.allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 28 --> Make sure this version is same with the one in your android/app/build.gradle
buildToolsVersion '28.0.3' --> Make sure this version is same with the one in your android/app/build.gradle
defaultConfig {
minSdkVersion 21 --> Make sure this version is same with the one in your android/app/build.gradle
targetSdkVersion 28 --> Make sure this version is same with the one in your android/app/build.gradle
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
lintOptions {
disable 'InvalidPackage'
}
dependencies {
def appCenterSdkVersion = '1.10.0'
implementation "com.microsoft.appcenter:appcenter:${appCenterSdkVersion}"
}
}
4 - Do the same process for the android [appcenter_analytics] & android [appcenter_crashes].
5 - In terminal type flutter clean and after it finishes type flutter build apk.

Related

Flutter firebase_messaging: ^6.0.13 failing with exception:

I am trying to implement push notification with firebase_messaging: ^6.0.13,
Flutter: Build errors for firebase_messaging”
I have looked through all similar cases, Migrated my project to AndroidX but I still cannot resolve my Android build errors:
Followed procedures.
Flutter clean
flutter packages pub cache repair
Restart Android
Remake emulator nothing is working
Migrated project to AndroidX
Tried downgrading the plugin versions
Exception:
Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle... 0.6s
Resolving dependencies... 2.5s
/home/rajeshpatil/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-6.0.13/android/src/main/java/io/flutter/plugins/firebasemessaging/FirebaseMessagingPlugin.java:80: error: cannot find symbol
onAttachedToEngine(binding.getApplicationContext(), binding.getBinaryMessenger());
^
symbol: method getBinaryMessenger()
location: variable binding of type FlutterPluginBinding
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':firebase_messaging:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 3.3s
Gradle task assembleDebug failed with exit code 1
project-level/build.gradle:
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
}
}
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
}
app-level/build.gradle:
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.")
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.helloworld"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
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
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
gradle.properties:
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
Flutter Doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.10.7, on Linux, locale en_IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.43.0)
[✓] Connected device (1 available)
• No issues found!
It looks like you are working on an older flutter project, try a few things and see if these help.
1) Update your flutter SDK. You are currently using a pretty old version of flutter, and a beta build that was never a stable release. Even if this doesnt solve your problem it would be wise to upgrade. You can do so by running flutter upgrade in your terminal.
2) You may be trying to use an older version of certain firebase packages, including messaging. Try changing classpath 'com.google.gms:google-services:4.3.0'
in your project gradle.build to classpath 'com.google.gms:google-services:3.2.1'. Do this only if updating your flutter SDK doesnt fix the issue, and if this doesnt help change it back.
3) Try increasing your minSDKVersion for the project in the app-level/build.gradle, in the past when I have had similar issues this fixed my problems around sdk version 21.

Gradle sync failed: Could not find method defaultConfig()

In the first instance my problem was Cause 1: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
but this has escalated since then and now my gradle is broken.
this is the error I am getting:
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\stackstorage\android projecten\Converter\build.gradle' line: 26
* What went wrong:
A problem occurred evaluating root project 'Converter'.
> Could not find method defaultConfig() for arguments [build_7komq7i2k7pl5720grjx3kada$_run_closure2#b894d83] on root project 'Converter' of type org.gradle.api.Project.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
CONFIGURE FAILED in 0s
Could not find method defaultConfig() for arguments [build_7komq7i2k7pl5720grjx3kada$_run_closure2#b894d83] on root project 'Converter' of type org.gradle.api.Project.
Open File
event log:
12:13 Gradle sync started with IDEA sync
12:13 Gradle sync failed: Could not find method defaultConfig() for arguments [build_7komq7i2k7pl5720grjx3kada$_run_closure2#55d7744a] on root project 'Converter' of type org.gradle.api.Project.
Consult IDE log for more details (Help | Show Log) (287 ms)
12:13 NDK Resolution Outcome: Project settings: Gradle model version=5.4.1, NDK version is UNKNOWN
12:13 Gradle sync started with IDEA sync
12:13 Gradle sync failed: Could not find method defaultConfig() for arguments [build_7komq7i2k7pl5720grjx3kada$_run_closure2#b894d83] on root project 'Converter' of type org.gradle.api.Project.
Consult IDE log for more details (Help | Show Log) (230 ms)
12:13 NDK Resolution Outcome: Project settings: Gradle model version=5.4.1, NDK version is UNKNOWN
I am unsure what code I need to post for this to get helped but I've seen people posting their build.gradle and gradle.properties, so i'll post mine.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.61'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
defaultConfig {
minSdkVersion 15
targetSdkVersion 28
multiDexEnabled true
}
task clean(type: Delete) {
delete rootProject.buildDir
}
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx4608m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
Thanks in advance to anyone willing to help. I kinda messed up here.
Check your app> build.gradle file. there will be defaultConfig() tag like this
defaultConfig {
applicationId "com.example.myApp"// your appId
minSdkVersion 17
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
In android studio, go to your project. Make sure you are in the view mode "Android". Just like this image:
Should be like this in android studio
Go to Gradle-Scripts -> build.gradle (module:app) and make sure it is composed similarly to this:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "your app id"
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//your dependencies
}
Move defaultConfig{} from gradle project to build.gradle's app module inside android tag.
Should be similar to this
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
repositories {
mavenCentral()
}
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

When I try to sync my Gradle files I get an error

I am currently building a Flutter app and almost everything has gone okay so far until I started getting this error. I've searched all over the internet for a solution but I have not found anything that solved it for me.
When I try to sync my Gradle files I get an error:
ERROR: Gradle DSL method not found: 'classpath()'
Possible causes:
The project 'android' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 3.5.2 and sync project
The project 'android' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file
The build file may be missing a Gradle plugin.
Apply Gradle plugin
I cant press the "Upgrade plugin to version 3.5.2 and sync project" as that fails.
When i try to build my app i get this error
Launching lib\main.dart on SM G973F in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "C:\Users\tbsvst18tedbom\AndroidStudioProjects\tab_truth_true\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\tbsvst18tedbom\AndroidStudioProjects\tab_truth_true\android\build.gradle' line: 15
* What went wrong:
A problem occurred evaluating root project 'android'.
> Could not find method classpath() for arguments [com.android.tools.build:gradle:3.5.2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 6s
Command: C:\Users\tbsvst18tedbom\AndroidStudioProjects\tab_truth_true\android\gradlew.bat app:properties
Finished with error: Please review your Gradle project setup in the android/ folder.
This is the project-lever build.gradle file:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
}
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
}
And this is the app-level build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
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.0.0'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
android {
compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.tab.tab_truth_true"
minSdkVersion 21
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
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
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.firebase:firebase-ads:18.3.0'
}
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin
The strange thing is that I don't have any Gradle settings, see image
{LINK} this is my gradle settings, as you see, all I get is this
I have tried to migrate to Android X but with no luck. I just says "no usages found"
In the project level build.gradle there is a duplicate class path:
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
}
Please delete the second occurrence outside the buildscript block and try to build again.

How to specify gradle version for subprojects or app level build.gradle

I have an Android (Kotlin) project that I want to test with spotbugs.
This testing will occur inside a docker container using the gitlab/sast image. It will detect a gradle project and then execute spotbugs tests on that project.
When I run this image with
docker run \
--interactive --tty --rm \
--volume ${MY_PROJECT}:/code \
--volume /var/run/docker.sock:/var/run/docker.sock \
registry.gitlab.com/gitlab-org/security-products/sast:12-4-stable /app/bin/run /code
The sast tool detects two projects in total, Gradlew and Gradle projects as showing in the logs.
Found Gradlew project in /tmp/app directory
Found Gradle project in /tmp/app/app directory
Found 2 analyzable projects.
The Gradlew is successfully built but the Gradle project fails to build.
Gradlew Plugin
Building Gradlew project at /tmp/app.
Downloading https://services.gradle.org/distributions/gradle-5.6.1-all.zip
Unzipping /root/.gradle/wrapper/dists/gradle-5.6.1-all/805usxkvhgx6e1wbo8o64g0tx/gradle-5.6.1-all.zip to /root/.gradle/wrapper/dists/gradle-5.6.1-all/805usxkvhgx6e1wbo8o64g0tx
Set executable permissions for: /root/.gradle/wrapper/dists/gradle-5.6.1-all/805usxkvhgx6e1wbo8o64g0tx/gradle-5.6.1/bin/gradle
Welcome to Gradle 5.6.1!
Here are the highlights of this release:
- Incremental Groovy compilation
- Groovy compile avoidance
- Test fixtures for Java projects
- Manage plugin versions via settings script
For more details see https://docs.gradle.org/5.6.1/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :app:assemble UP-TO-DATE
> Task :app:lint SKIPPED
> Task :app:compileJava NO-SOURCE
> Task :app:processResources NO-SOURCE
> Task :app:classes UP-TO-DATE
> Task :app:spotbugsMain
Warning at xsl:variable on line 348 column 57 of default.xsl:
SXWN9001: A variable with no following sibling instructions has no effect
Warning at xsl:variable on line 351 column 57 of default.xsl:
SXWN9001: A variable with no following sibling instructions has no effect
> Task :app:check
> Task :app:build
BUILD SUCCESSFUL in 1m 49s
1 actionable task: 1 executed
Project built.
Gradle Plugin
Building Gradle project at /tmp/app/app.
Welcome to Gradle 5.1!
Here are the highlights of this release:
- Control which dependencies can be retrieved from which repositories
- Production-ready configuration avoidance APIs
For more details see https://docs.gradle.org/5.1/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
* Where:
Build file '/tmp/app/app/build.gradle' line: 6
* What went wrong:
An exception occurred applying plugin request [id: 'com.github.triplet.play', version: '2.5.0']
> Failed to apply plugin [id 'com.github.triplet.play']
> Gradle Play Publisher's minimum Gradle version is at least Gradle 5.6.1 and yours is Gradle 5.1. Find the latest version at https://github.com/gradle/gradle/releases, then run './gradlew wrapper --gradle-version=$LATEST --distribution-type=ALL'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 38s
Error: Project couldn't be built: exit status 1
2019/11/18 21:49:23 exit status 1
2019/11/18 21:49:23 Container exited with non zero status code
Just to provide some background on the com.github.triplet.play tool, it's a gradle plugin that is used to publish apk's to the Play Store.
I was not expecting the Gradle project to use version 5.1 because the Gradlew project used version 5.6.1 and in gradle/wrapper/gradle-wrapper.properties (project-level) I have specified version 5.6.1.
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-all.zip
build.gradle (project-level)
buildscript {
ext.kotlinVersion = '1.3.50'
ext.espressoVersion = "3.2.0"
ext.ktlintVersion = "9.1.0"
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
allprojects {
apply from: "$rootDir/ktlint.gradle"
repositories {
google()
jcenter()
}
}
build.gradle (app-level)
plugins {
id 'com.github.triplet.play' version '2.5.0'
id "com.github.spotbugs" version "2.0.1"
id "com.github.hierynomus.license-report" version"0.15.0"
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: "com.github.spotbugs"
android {
compileSdkVersion 29
defaultConfig {
applicationId "<REDACTED>"
minSdkVersion 21
targetSdkVersion 29
versionCode Integer.valueOf(System.env.VERSION_CODE ?: 1)
versionName "${System.getenv('APPLICATION_VERSION')}-${System.getenv('APPLICATION_BUILD_STAGE')}-${System.env.VERSION_SHA}"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
storeFile file("${System.getenv('KEYSTORE_FILE_PATH')}")
storePassword "${System.getenv('SIGNING_KEY_PASSWORD')}"
keyAlias "${System.getenv('SIGNING_KEY_ALIAS')}"
keyPassword "${System.getenv('SIGNING_KEY_PASSWORD')}"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
tasks.lint.enabled = false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "androidx.test.espresso:espresso-idling-resource:$espressoVersion"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.7.1'
}
play {
serviceAccountCredentials = file("${System.getenv('PLAY_STORE_JSON_CONFIG_PATH')}")
releaseStatus = "${System.getenv('PLAY_RELEASE_STATUS')}"
}
spotbugs {
toolVersion = '4.0.0-beta4'
excludeFilter = file("$rootProject.projectDir/spotbugs/excludeFilter.xml")
reportsDir = file("$project.buildDir/spotbugsReports")
}
tasks.withType(com.github.spotbugs.SpotBugsTask) {
classes = files("$project.buildDir/intermediates/javac")
source = fileTree("app/src/main/java")
reports {
html.enabled = true
xml.enabled = false
}
}
sourceSets {
// we define `main` sourceSet here, so SpotBugs Gradle Plugin generates `spotbugsMain` task
main {
java.srcDirs = []
}
}
downloadLicenses {
dependencyConfiguration "compile"
}
Is there anyway in Gradle to configure the tmp/app/app (Gradle project) to use version 5.6.1 instead of version 5.1

Unable to publish Android library project on JitPack

I made a small library for Android which I uploaded on my public Github repositroy. The library project contains also a sample app. To enable building on JitPack I followed JitPack's own instructions.
Now that i try build it remotely with JitPack i get following error:
WARNING:
Gradle 'install' task not found. Please add the 'maven' or 'android-maven' plugin.
See the documentation and examples: https://jitpack.io/docs/
Adding maven plugin
Found android library build file in Library
Running: gradle clean -Pgroup= -Pversion=v1.2 install
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Djavax.xml.accessExternalSchema=all
Gradle version Gradle 3.1
FAILURE: Build failed with an exception.
* What went wrong:
Task 'clean' not found in root project 'build'.
* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 0.532 secs
EXIT_CODE=1
2017-03-22T19:01:33.352614259Z
Exit code: 1
No build artifacts found
Here is the root build file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Build file for the library:
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
group=
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 15
targetSdkVersion 25
}
}
Build file for the sample app:
apply plugin: 'com.android.application'
buildscript {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.2.0'
compile project(':Library')
}
The project is missing a settings.gradle file where you include the library:
include ':Library'
Would also recommend adding the gradle wrapper so that JitPack builds with the correct Gradle version.
Example project: https://github.com/jitpack/android-example

Categories

Resources