eas build error after updating from 48 to 49 - Could not set unknown property 'classifier' for task ':expo-device:androidSourcesJar'

Please provide the following:

  1. SDK Version: 49
  2. Platforms(Android/iOS/web/all): android
  3. Add the appropriate “Tag” based on what Expo library you have a question on.
Running 'gradlew :app:bundleRelease' in /home/expo/workingdir/build/android

2

Downloading https://services.gradle.org/distributions/gradle-8.0.1-all.zip

3

10%.

4

20%.

5

30%

6

40%.

7

50%.

8

60%.

9

70%

10

80

11

%.

12

90%

13

100%

14

Welcome to Gradle 8.0.1!

15

Here are the highlights of this release:

16

 - Improvements to the Kotlin DSL

17

 - Fine-grained parallelism from the first build with configuration cache

18

 - Configurable Gradle user home cache cleanup

19

For more details see https://docs.gradle.org/8.0.1/release-notes.html

20

To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/8.0.1/userguide/gradle_daemon.html#sec:disabling_the_daemon.

21

Daemon will be stopped at the end of the build

22

> Task :expo-updates-gradle-plugin:pluginDescriptors

23

> Task :expo-updates-gradle-plugin:processResources

24

> Task :gradle-plugin:pluginDescriptors

25

> Task :gradle-plugin:processResources

26

> Task :expo-dev-launcher-gradle-plugin:pluginDescriptors

27

> Task :expo-dev-launcher-gradle-plugin:processResources

28

> Task :expo-dev-launcher-gradle-plugin:compileKotlin

29

> Task :expo-dev-launcher-gradle-plugin:compileJava NO-SOURCE

30

> Task :expo-dev-launcher-gradle-plugin:classes

31

> Task :expo-dev-launcher-gradle-plugin:jar

32

> Task :expo-dev-launcher-gradle-plugin:inspectClassesForKotlinIC

33

> Task :gradle-plugin:compileKotlin

34

> Task :gradle-plugin:compileJava NO-SOURCE

35

> Task :gradle-plugin:classes

36

> Task :gradle-plugin:jar

37

> Task :gradle-plugin:inspectClassesForKotlinIC

38

> Task :expo-updates-gradle-plugin:compileKotlin

39

> Task :expo-updates-gradle-plugin:compileJava NO-SOURCE

40

> Task :expo-updates-gradle-plugin:classes

41

> Task :expo-updates-gradle-plugin:jar

42

> Task :expo-updates-gradle-plugin:inspectClassesForKotlinIC

43

> Configure project :app

44

ℹ️  Applying gradle plugin 'expo-dev-launcher-gradle-plugin' (expo-dev-launcher@2.4.8)

45

 ℹ️  Applying gradle plugin 'expo-updates-gradle-plugin' (expo-updates@0.18.10)

46

> Configure project :expo-av

47

Checking the license for package NDK (Side by side) 23.1.7779620 in /home/expo/Android/Sdk/licenses

48

License for package NDK (Side by side) 23.1.7779620 accepted.

49

Preparing "Install NDK (Side by side) 23.1.7779620 (revision: 23.1.7779620)".

50

"Install NDK (Side by side) 23.1.7779620 (revision: 23.1.7779620)" ready.

51

Installing NDK (Side by side) 23.1.7779620 in /home/expo/Android/Sdk/ndk/23.1.7779620

52

"Install NDK (Side by side) 23.1.7779620 (revision: 23.1.7779620)" complete.

53

"Install NDK (Side by side) 23.1.7779620 (revision: 23.1.7779620)" finished.

54

Checking the license for package CMake 3.22.1 in /home/expo/Android/Sdk/licenses

55

License for package CMake 3.22.1 accepted.

56

Preparing "Install CMake 3.22.1 (revision: 3.22.1)".

57

"Install CMake 3.22.1 (revision: 3.22.1)" ready.

58

Installing CMake 3.22.1 in /home/expo/Android/Sdk/cmake/3.22.1

59

"Install CMake 3.22.1 (revision: 3.22.1)" complete.

60

"Install CMake 3.22.1 (revision: 3.22.1)" finished.

61[stderr]

FAILURE: Build completed with 2 failures.

62[stderr]

1:

63[stderr]

Task failed with an exception.

64[stderr]

-----------

65[stderr]

* Where:

66[stderr]

Build file '/home/expo/workingdir/build/node_modules/expo-device/android/build.gradle' line: 40

67[stderr]

* What went wrong:

68[stderr]

A problem occurred evaluating project ':expo-device'.

69[stderr]

>

70[stderr]

Could not set unknown property 'classifier' for task ':expo-device:androidSourcesJar' of type org.gradle.api.tasks.bundling.Jar.

71[stderr]

* Try:

72[stderr]

>

73[stderr]

Run with

74[stderr]

--stacktrace

75[stderr]

option to get the stack trace.

76[stderr]

>

77[stderr]

Run with

78[stderr]

--info

79[stderr]

or

80[stderr]

--debug

81[stderr]

option to get more log output.

82[stderr]

>

83[stderr]

Run with

84[stderr]

--scan to get full insights.

85[stderr]

==============================================================================

86[stderr]

2: Task failed with an exception.

87[stderr]

-----------

88[stderr]

* What went wrong:

89[stderr]

A problem occurred configuring project ':expo'.

90[stderr]

> compileSdkVersion is not specified. Please add it to build.gradle

91[stderr]

* Try:

92[stderr]

> Run with --stacktrace option to get the stack trace.

93[stderr]

> Run with --info or --debug option to get more log output.

94[stderr]

> Run with

95[stderr]

--scan to get full insights.

96[stderr]

==============================================================================

97[stderr]

* Get more help at https://help.gradle.org

98[stderr]

BUILD FAILED in 2m 42s

99

15 actionable tasks: 15 executed

100

Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

up for this. did you find any solution?

Getting same error. Have you resolved it?

Hey @devpaul003 and @fludder, Starting from Expo SDK 49 (React Native 0.72), the React Native Android project uses Gradle 8 as the default version. If your project includes custom Expo Modules, you might encounter build errors or warnings related to this change. Please see the migration guide: https://github.com/expo/fyi/blob/main/expo-modules-gradle8-migration.md#error-unknown-property-classifier

@amanhimself Thanks for your reply but I don’t have build.gradle file in my project

@sibiyan Have you resolved this issue?

This is still an issue and not fixed. Expo team please advise on this issue.

There is no build.gradle in my expo project either. This worked fine in sdk 48

@Expo Team please guide us on this issue. We are stuck.

Currently having the same issue. As the project is managed I don’t have access to gradle file. @Expo please help!

I’m having the same problem.

 Configure project :app

38

 ℹ️  Applying gradle plugin 'expo-updates-gradle-plugin' (expo-updates@0.18.11)

39

[stderr]

FAILURE: Build completed with 2 failures.

40

[stderr]

1: Task failed with an exception.

41

[stderr]

-----------

42

[stderr]

* Where:

43

[stderr]

Build file '/home/expo/workingdir/build/node_modules/expo-app-auth/android/build.gradle' line: 25

44

[stderr]

* What went wrong:

45

[stderr]

A problem occurred evaluating project ':expo-app-auth'.

46

[stderr]

> Could not set unknown property 'classifier' for task ':expo-app-auth:androidSourcesJar' of type org.gradle.api.tasks.bundling.Jar.

47

[stderr]

* Try:

48

[stderr]

> Run with --stacktrace option to get the stack trace.

49

[stderr]

> Run with --info or --debug option to get more log output.

50

[stderr]

> Run with --scan to get full insights.

51

[stderr]

==============================================================================

52

[stderr]

2: Task failed with an exception.

53

[stderr]

-----------

54

[stderr]

* What went wrong:

55

[stderr]

A problem occurred configuring project ':expo'.

56

[stderr]

> compileSdkVersion is not specified. Please add it to build.gradle

57

[stderr]

* Try:

58

[stderr]

> Run with --stacktrace option to get the stack trace.

59

[stderr]

> Run with --info or --debug option to get more log output.

60

[stderr]

> Run with --scan to get full insights.

61

[stderr]

==============================================================================

62

[stderr]

* Get more help at https://help.gradle.org

63

[stderr]

BUILD FAILED in 2m 18s

64

10 actionable tasks: 10 executed

65

Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

Hello All,

Finally I downgraded my Expo SDK to 47 and resolved the issue.

Hello @fludder ,
Could you please give me a step by step process for this build. I have been on this build since last week and there is nothing frustrating as “seeing your app work on your own device but can’t share with your team or partner”. I have downloaded and even upgraded but still nothing to show forth to a successful build.

I found a plugin that claims to handle gradle configuration setup and I used iit but but yet I found my self here with this error “Could not set unknown property ‘classifier’ for task ‘:expo-app-auth:androidSourcesJar’ of type org.gradle.api.tasks.bundling.Jar”.

I have upgraded to expo 49 and react-native 0.72. I have done installing and uninstalling of node_modules more than 200millions time.

Please help if you can

For this kind of error, i found this solution that strictly addresses the issue but the step, guide and where to add the code was very poor. I modified my bundle.gradle file but got another error
Could not find method androidSourcesJar() for arguments [{type=class org.gradle.api.tasks.bundling.Jar}, build_3rx9id5qscpq1sxlbnndphbmo$_run_closure1$_closure3@460ef5d9] on object of type org.gradle.api.internal.initialization.DefaultScriptHandler.

Below is how i modified my build.gradle file:


// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext {
buildToolsVersion = findProperty(‘android.buildToolsVersion’) ?: ‘33.0.0’
minSdkVersion = Integer.parseInt(findProperty(‘android.minSdkVersion’) ?: ‘21’)
compileSdkVersion = Integer.parseInt(findProperty(‘android.compileSdkVersion’) ?: ‘33’)
targetSdkVersion = Integer.parseInt(findProperty(‘android.targetSdkVersion’) ?: ‘33’)
kotlinVersion = findProperty(‘android.kotlinVersion’) ?: ‘1.8.10’
frescoVersion = findProperty(‘expo.frescoVersion’) ?: ‘2.5.0’

    // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
    ndkVersion = "23.1.7779620"
}

// Creating sources with comments
task androidSourcesJar(type: Jar) {
classifier = ‘sources’
from android.sourceSets.main.java.srcDirs
}

afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
// Add additional sourcesJar to artifacts
artifact(androidSourcesJar)
}
}
}
}

android {
lintOptions {
abortOnError false
}
publishing {
singleVariant(“release”) {
withSourcesJar()
}
}
}

repositories {
    google()
    mavenCentral()
}
dependencies {
    classpath('com.android.tools.build:gradle:7.4.2')
    classpath('com.facebook.react:react-native-gradle-plugin')
}

}

allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url(new File([‘node’, ‘–print’, “require.resolve(‘react-native/package.json’)”].execute(null, rootDir).text.trim(), ‘…/android’))
}
maven {
// Android JSC is installed from npm
url(new File([‘node’, ‘–print’, “require.resolve(‘jsc-android/package.json’)”].execute(null, rootDir).text.trim(), ‘…/dist’))
}

    google()
    mavenCentral()
    maven { url 'https://www.jitpack.io' }
}

}
// @generated begin expo-camera-import - expo prebuild (DO NOT MODIFY) sync-f244f4f3d8bf7229102e8f992b525b8602c74770
def expoCameraMavenPath = new File([“node”, “–print”, “require.resolve(‘expo-camera/package.json’)”].execute(null, rootDir).text.trim(), “…/android/maven”)
allprojects { repositories { maven { url(expoCameraMavenPath) } } }
// @generated end expo-camera-import


I got the same problem because expo auth is depreciated . I uninstalled it

npm uninstall expo-app-auth

and replace it with : expo-auth-session

npm i expo-auth-session

And now it works , i also uninstall expo cli in my case but , nor sure it was a problem

1 Like

Uninstalling expo-cli was the right thing to do. It should not be installed as a dependency

i dont even have expo-app-auth installed in my project, then I am getting this error?

1 Like

Hey @olammiewisdom , I have not found the solution. I just downgraded to Expo 47. It is just temporary solution. If you want help in that. Let me know.

I got basically the same issue after adding FirebaseRecaptcha. I would also really appreciate some help! I don’t think I can downgrade Expo because I’m quite sure I upgraded out of a different dependency issue :sweat_smile:

Could not set unknown property 'classifier' for task ':expo-firebase-core:androidSourcesJar' of type org.gradle.api.tasks.bundling.Jar.

My dependencies:

   "@expo/webpack-config": "^19.0.0",
    "@react-native-async-storage/async-storage": "1.18.2",
    "@react-native-community/datetimepicker": "7.2.0",
    "@react-navigation/native": "^6.1.6",
    "@react-navigation/native-stack": "^6.9.12",
    "@rneui/base": "^4.0.0-rc.7",
    "@rneui/themed": "^4.0.0-rc.7",
    "@types/luxon": "^3.3.0",
    "add": "^2.0.6",
    "eslint": "^8.44.0",
    "eslint-plugin-react-native": "^4.0.0",
    "expo": "^49.0.0",
    "expo-build-properties": "~0.8.3",
    "expo-constants": "~14.4.2",
    "expo-device": "~5.4.0",
    "expo-firebase-recaptcha": "^2.3.1",
    "expo-haptics": "~12.4.0",
    "expo-image-picker": "~14.3.2",
    "expo-linking": "~5.0.2",
    "expo-notifications": "~0.20.1",
    "expo-status-bar": "~1.6.0",
    "expo-updates": "~0.18.16",
    "firebase": "^9.20.0",
    "install": "^0.13.0",
    "luxon": "^3.3.0",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.72.6",
    "react-native-confirmation-code-field": "^7.3.1",
    "react-native-international-phone-number": "^0.5.3",
    "react-native-safe-area-context": "4.6.3",
    "react-native-screens": "~3.22.0",
    "react-native-toast-message": "^2.1.6",
    "react-native-vector-icons": "^9.2.0",
    "react-native-web": "~0.19.6",
    "react-native-webview": "13.2.2",
    "typescript": "^5.1.3"

Hi @awarely.social

Not sure what’s causing your build problem, but do you need the above, it looks like it might have been installed by accident

Same with this.

1 Like

wodin Good point, thank you! As you say, not related to the build problem. :neutral_face: