Unable to build Android


#1

Hi guys,

I am trying to update an old app (v2.5.x) to the current one.

When I call forge build android I see this message, but there are no docs enteries about this:

  • What went wrong:
    Execution failed for task ‘:ForgeInspector:preVanillaReleaseBuild’.
    Android dependency ‘com.android.support:appcompat-v7’ has different version for the compile (22.0.0) and runtime (28.0.0) classpath. You should manually set the same version via DependencyResolution

I am new to trigger.io so no idea where to look


#2

This is probably caused by module incompatibilities.

Make sure your app is on the latest Forge version (v.2.7.8) and all your modules have been updated to the latest versions.

If you’re still having an issue, please attach your src/config.json file to a post.

(Attach it as a file, don’t copy & paste! The forum software detroys the format if you try include it directly!)


#4

I have this one custom module, I have rebuiled this with current sdk still I have this error, any idea? I have this error only if I compile it with this module.

config of the app

{
	"config_version": "4",
	"name": "...",
	"author": "...",
	"version": "1.3.0",
	"platform_version": "v2.7.8",
	"description": "...",
	"core": {
		"general": {
			"logging": {
				"level": "WARNING"
			}
		},
		"android": {
			"package_name": "...",
			"minimum_version": "25"
		},
		"ios": {
			"disable_web_storage_backup": true,
			"package_name": "...",
			"webview": "WKWebView",
			"device_family": "iphone"
		}
	},
	"modules": {
		"platform": {
			"version": "2.3"
		},
		"file": {
			"version": "2.23",
			"config": {
				"usage_description": "This app needs to store your travel documents, e.g. the voucher, on the device."
			}
		},
		"display": {
			"version": "2.11",
			"config": {
				"orientations": {
					"ipad": "portrait",
					"android": "portrait",
					"iphone": "portrait"
				}
			}
		},
		"notification": {
			"version": "2.8"
		},
		"prefs": {
			"version": "2.2"
		},
		"tabs": {
			"version": "2.23"
		},
		"browsersettings": {
			"version": "1.6",
			"config": {
				"accept_cookies": true
			}
		},
		"android_screen_size": {
			"version": "0.0.3",
			"disabled": true
		},
		"intent_manager": {
			"version": "0.3.1",
			"disabled": true
		},
		"file_with_headers": {
			"version": "0.2.1",
			"disabled": true
		},
		"ga": {
			"version": "0.1.1",
			"disabled": true
		},
		"pushnotifications": {
			"version": "0.1.17",
			"disabled": true
		}
	},
	"homepage": "..."
}

module config

{

"description": "Google Analytics SDK",

"min_platform_version": "v2.7.8",

"namespace": "ga",

"platform_version": "v2.7.8",

"version": "0.1.1"

}

#5

Ah okay, then you’ll probably need to check your custom module and make sure that any dependencies you’re using match whatever we’re using in the Forge runtime:

Android Support library version: v28.0.0
Compile SDK version: 28
Google services: 4.2.0

I haven’t worked with the Google Analytics SDK so there’s not much else I can offer in terms of advice.


#6

I have done some research:

> Android dependency 'com.android.support:appcompat-v7' has different version for the compile (26.1.0) and runtime (28.0.0) classpath. You should manually set the same version via DependencyResolution

https://github.com/flutter/flutter/issues/14020

some people suggest to add

    implementation "com.android.support:support-v4:27.1.1" // added this

and some

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "26.1.0"
            }
        }
    }
}

can this be done with build_steps.json or is there a way to accomplish this somehow with trigger.io?
Usually I can change the java code to fix problems like this :slight_smile:


#7

Even if you could add custom gradle rules to force override dependencies I’d advise strongly against it as it will create even more issues for you down the line and we would no longer be able to offer you any level of support with your app.

Also take note that the next major release of Android (and therefore Forge v2.8.x) will be deprecating the com.android.support.* namespace entirely in favour of the new androidx namespace.

You will need to fix this at the source by bringing your custom module and any dependencies it may have up to date with the rest of the Android ecosystem.


#8

Hm, but all I do I am adding this line in build_steps

{
    "do": {
        "android_add_gradle_dependency": "com.google.android.gms:play-services:7.5.0"
    }
}

There is a conflict… ok, the only sad thing is, ios is working fine.

Then maybe an update will help:

{
    "do": {
        "android_add_gradle_dependency": "com.google.android.gms:play-services-analytics:17.0.0"
    }
}

nope…

* What went wrong:
Execution failed for task ':ForgeInspector:processVanillaReleaseManifest'.

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from AndroidManifest.xml:21:43-87
is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add ‘tools:replace=“android:appComponentFactory”’ to element at AndroidManifest.xml:8:5-21:954 to override.

adding the replace commando does not help. Maybe this should be added to the app? But the app does not support build steps, or isn’t it?


#9

The very latest Google lib versions have already dropped support for com.android.support in favour of androidx.

Forge v2.8.x brings support for this but it’s still in alpha.

If you’re feeling brave you can try developing your module against Forge platform version: v2.8.0

Change logs can be found here:

https://trigger.io/docs/current/api/beta_release_notes.html