Godot-Share icon indicating copy to clipboard operation
Godot-Share copied to clipboard

Android build issue (androidx.core.v4.content does not exist)

Open cemeai opened this issue 4 years ago • 6 comments

When I try compiling for android getting an error for a library does not exists. Could it be a version error? maybe something i need to make sure i have enabled? I honestly not sure if you need more infotmation to know what is going on so let me know

Here is the error i get

./gradlew build

Configure project : WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Task :compileDebugJavaWithJavac FAILED /Users/cesar.amaro/Documents/godot-3.1/modules/share/android/GodotShare.java:9: error: package androidx.core.v4.content does not exist import androidx.core.v4.content.FileProvider; ^ /Users/cesar.amaro/Documents/godot-3.1/modules/share/android/GodotShare.java:52: error: cannot find symbol uri = FileProvider.getUriForFile(activity, activity.getPackageName(), f); ^ symbol: variable FileProvider location: class GodotShare Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. 2 errors

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 2s

cemeai avatar Jun 01 '20 20:06 cemeai

Did you do this (from readme file)?

open (Project)/android/build/gradle.properties file and add the following line

android.useAndroidX=true
android.enableJetifier=true

Shin-NiL avatar Jun 02 '20 11:06 Shin-NiL

I missed that but then did and got a different error

Task :compileDebugJavaWithJavac FAILED /Users/cesar.amaro/Documents/godot-3.1/platform/android/java/src/org/godotengine/godot/Godot.java:65: error: package android.support.v4.content does not exist import android.support.v4.content.ContextCompat;

so first it was androidx and now android.support

maybe i need to enable something else?

cemeai avatar Jun 02 '20 17:06 cemeai

What Godot version are you compiling?

Shin-NiL avatar Jun 02 '20 23:06 Shin-NiL

3.1

cemeai avatar Jun 03 '20 17:06 cemeai

I don't use this module anymore, I've migrate to the plugin system in 3.2. I can't say if 3.1 is compatible with Android X. One thing you can try is to use a version of this module before the Android X support was added. You can checkout this commit 266e07086b965aea80ca1d6f059490c62dc945fd

Shin-NiL avatar Jun 04 '20 11:06 Shin-NiL

thx ill try

cemeai avatar Jun 05 '20 16:06 cemeai