Skip to content

Android - MainApplication.kt Unresolved reference: IterableApi #793

Open

Description

@miarevalo10

Issue

We have updated from 2.02 to 2.1.0 while also enabling the new architecture on our app and we are facing an error when building android

> Task :app:compileDebugKotlin FAILED
MainApplication.kt:23:12 Unresolved reference: iterable
MainApplication.kt:55:5 Unresolved reference: IterableApi
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

These lines (IterableApi.setContext(this) were added following Iterable's docs guidance, and it was working until we made this upgrade to 2.1.0

What I've tried so far

  • I tried to remove those lines as I did not see them in the example project, and although that made the build pass, when the app was opened I am now seeing this
Image

What is the current guidance for installing this sdk for react native + android?
We are currently using:

"react-native": "0.76.9",
"@iterable/react-native-sdk": "~2.1.0",
"expo": "52.0.19",

Activity

  1. lposen commented on Jan 9, 2026

    @lposen
    Contributor

    Hi @miarevalo10,

    Thanks for reporting this. This is likely due to old build artifacts still being present. Cleaning Android then rebuilding should fix this issue:

    cd android
    ./gradlew clean

    Also, please make sure that:

    1. You are on the correct node version (v20.19.0)
    2. The correct variables are exposed in your .zshrc or .bash_profile. EG: JAVA_HOME, ANDROID_HOME, etc. See the react native docs for more details.

    Regarding IterableApi.setContext(this) -- that definitely should be in your app, and is an oversight in our example application. Thanks for pointing it out! We will create a ticket for adding this into our example app.

    Please let me know if you have any further issues.

  2. miarevalo10 commented on Jan 13, 2026

    @miarevalo10
    Author

    Hi @lposen

    Thanks for your reply. Unfortunately cleaning did not fix the issue, I tried your suggestion and I also tried:

    cd android
    rm -rf .gradle build app/build app/.cxx
    ./gradlew clean
    

    We're currently on node version v24.12.0, this is a requirement by another third party sdk we use, so it is not an option to downgrade right now.

    I was able to find a workaround by manually linking the library using react-native.config.js:

    const path = require('path');
    
    module.exports = {
      dependencies: {
        'react-native-vector-icons': {
          platforms: {
            ios: null,
          },
        },
        // Lines below fixed the issue
        '@iterable/react-native-sdk': {
          platforms: {
            android: {
              sourceDir: path.join(
                __dirname,
                'node_modules/@iterable/react-native-sdk/android',
              ),
              /*
                These manual configurations are required because autolinking
                fails to parse the package information from the source files
                due to the non-standard file structure of this library.
              */
              packageImportPath:
                'import com.iterable.reactnative.RNIterableAPIPackage;',
              packageInstance: 'new RNIterableAPIPackage()',
              libraryName: 'RNIterableAPISpec',
              componentDescriptors: [],
              cmakeListsPath: path.join(
                __dirname,
                'node_modules/@iterable/react-native-sdk/android/build/generated/source/codegen/jni/CMakeLists.txt',
              ),
            },
          },
        },
      },
    };

    Looks like autolinking is failing in our project and having this works for now. Given this is not a permanent fix because of its hacky nature, I would like to know if there's a better way to troubleshoot autolinking not working in our project

    Thanks in advance

  3. lposen commented on Jan 16, 2026

    @lposen
    Contributor

    Hi @miarevalo10,

    Sorry that you're experiencing these issues.

    What version of React Native are you using?

  4. miarevalo10 commented on Jan 16, 2026

    @miarevalo10
    Author

    Hi @lposen

    We're currently using :

    "react-native": "~0.77.3",
    "expo": "52.0.27",
    "@iterable/react-native-sdk": "~2.1.0",
    
  5. added a commit that references this issue on Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions