Android-nRF-Toolbox build error(Unresolved reference: theme)

Hi, I have similar error on this thread:

 Android-nRF-Toolbox build error(Unresolved reference: theme) 

I cloned current latest releases of Android-nRF-Toolbox(3.1.3), Android ble library(2.5.1),  and Android common library(1.0.27) source code from github to the same folder.

I am using Android Studio Dolphin | 2021.3.1 Patch 1
Build #AI-213.7172.25.2113.9123335, built on September 30, 2022
Runtime version: 11.0.13+0-b1751.21-8125866 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 3072M
Cores: 8

At start it shows error the newest gradle version is 7.3.1, so I modified build.gradle for it to 7.3.1 for all modules

Then I got build error for all files that uses theme and analytics.

I searched the errors and found only that solution.
change
import
no.nordicsemi.android.theme.ScreenSection
to
import no.nordicsemi.android.material.you.ScreenSection
But I have to downgrade the Android common library to 1.0.10 in order to use that solution.

I also needed to do similar changes for analytics. (change to import no.nordicsemi.android.analytics. ...)

But still there is no successfull build.
Then I tried different release numbers combinations of nrftoolbox, ble-library and common-library. Unfortunately there are nearly infinetely many combinations.
At the end, I spent 2 days without success and now I feel exhausted for trial and error.
I stopped at this error. And I did not find anything relevant to this error on the internet.

Android-nRF-Toolbox\app\build\tmp\kapt3\stubs\debug\no\nordicsemi\android\nrftoolbox\MainActivity.java:7: error: [Hilt]
public final class MainActivity {
             ^
  @AndroidEntryPoint base class must extend ComponentActivity, (support) Fragment, View, Service, or BroadcastReceiver.
  [Hilt] Processing did not complete. See error above for details.


What is the solution for the error?
And please give us compatible release numbers of ble library and common library to the latest NRFtoolbox release(3.1.3). If there isn't any, please update the Android-nrftoolbox that can be build without error, according to latest ble and common libraries.
Thanks in advance.
Parents Reply Children
  • Thanks for your answer. Even if I use 1.0.10, I have a lot of errors. Could you provide us compatible release numbers of ble library and common library to the latest NRFtoolbox release(3.1.3)?

  • I switched to

    Android-nRF-Toolbox-3.1.3
    Android-BLE-Library-2.4.1
    Android-Common-Libraries-1.0.13

    according to settings.gradle file

    But now I have gradle sync issues.

    class com.android.tools.idea.gradle.project.sync.ModelCacheV2ImplKt$modelCacheV2Impl$1 cannot be cast to class com.android.tools.idea.gradle.project.sync.ModelCache$V1 (com.android.tools.idea.gradle.project.sync.ModelCacheV2ImplKt$modelCacheV2Impl$1 and com.android.tools.idea.gradle.project.sync.ModelCache$V1 are in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @4fe9985b)
    class com.android.tools.idea.gradle.project.sync.ModelCacheV2ImplKt$modelCacheV2Impl$1 cannot be cast to class com.android.tools.idea.gradle.project.sync.ModelCache$V1 (com.android.tools.idea.gradle.project.sync.ModelCacheV2ImplKt$modelCacheV2Impl$1 and com.android.tools.idea.gradle.project.sync.ModelCache$V1 are in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @4fe9985b)
    
    Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
    
    Re-download dependencies and sync project (requires network)
    The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
    
    Stop Gradle build processes (requires restart)
    Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
    
    In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
    
    

    What must Android Gradle Plugin version and Gradle version be in the project structure?

  • Those you can use matching your current Android Studio version. I guess it's 7.3.1 now I'm Chipmunk. Just the common library dependency should be left to 1.0.13, other can be set to meet ones.

Related