Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

[Bug]: LogSender dependency cannot be found in React Native projects #1274

Closed
2 tasks done
BanDroid opened this issue Sep 9, 2023 · 12 comments
Closed
2 tasks done

[Bug]: LogSender dependency cannot be found in React Native projects #1274

BanDroid opened this issue Sep 9, 2023 · 12 comments
Labels
bug Something isn't working
Milestone

Comments

@BanDroid
Copy link
Member

BanDroid commented Sep 9, 2023

What happened?

react native project have their own gradle configuration, the configuration seems compatible with AndroidIDE, only error when build in the app because of logsender, build in terminal is working just fine.

here's the logs.
here's the project in case you want to see the configuration.

What's the expected behavior?

build success

What version of AndroidIDE you're using?

v2.5.2 (debug builds)

Relevant log output

-

Duplicate issues

  • This issue has not been reported yet.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@BanDroid BanDroid added the bug Something isn't working label Sep 9, 2023
@itsaky
Copy link
Member

itsaky commented Sep 9, 2023

Sure, I'll look into it.

@itsaky itsaky added this to the v2.6.0-beta milestone Sep 9, 2023
@BanDroid
Copy link
Member Author

BanDroid commented Sep 9, 2023

@itsaky maybe add a fallback when logsender isn't enabled? because i tried to disable logsender in developer settings, it still trying to install logsender dependencies in the project

@itsaky itsaky changed the title [Bug]: repository cant be found [Bug]: LogSender dependency cannot be found in React Native projects Sep 9, 2023
@itsaky
Copy link
Member

itsaky commented Sep 9, 2023

With the above commit (42ac697), the log sender dependency won't be added if log sender is disabled in AndroidIDE's developers options.

@BanDroid
Copy link
Member Author

BanDroid commented Sep 9, 2023

it's still trying to add logsender dependency, i have disabled logsender and also ide logs show the logsender.isEnabled to false, but somehow the build failed with the same error.

ToolingApiServer          D   ToolingApiMain             Arguments from tooling client:  [--init-script, /data/data/com.itsaky.androidide/files/home/.androidide/init/init.gradle, -Pandroid.aapt2FromMavenOverride=/data/data/com.itsaky.androidide/files/home/.androidide/aapt2, -Pandroidide.logsender.isEnabled=false, --stacktrace, --build-cache]  

@itsaky
Copy link
Member

itsaky commented Sep 9, 2023

Check the build output, does it say LogSender is disabled?

@BanDroid
Copy link
Member Author

BanDroid commented Sep 9, 2023

Check the build output, does it say LogSender is disabled?

no, here's the new build logs, it still the same but with logsender disabled in developer settings.

i have try with clean task too, and also removing the build folder manually, still no progress.

@BanDroid
Copy link
Member Author

init.gradle contains this

initscript {
    repositories {
        
        // Always specify the snapshots repository first
        maven {
            // Add snapshots repository for AndroidIDE CI builds
            url "https://s01.oss.sonatype.org/content/repositories/snapshots/"
        }
        
        mavenCentral()
        google()
    }

    dependencies {
        classpath 'com.itsaky.androidide:gradle-plugin:2.5.3-beta-42ac69785-SNAPSHOT'
    }
}

apply plugin: com.itsaky.androidide.gradle.AndroidIDEInitScriptPlugin

what happen if i remove manually the logsender plugin in here?

@itsaky
Copy link
Member

itsaky commented Sep 11, 2023

what happen if i remove manually the logsender plugin in here?

I think this would fix the problem for you (but it's just a workaround).

Currently, the init script is only used to add LogSender to the project. So, even if you edit the init script to not apply the plugins, the project initialisation would work just fine in the IDE (you won't be able to use LogSender though).

Edit :
If you want to use this workaround, just remove this line :

apply plugin: com.itsaky.androidide.gradle.AndroidIDEInitScriptPlugin

@BanDroid
Copy link
Member Author

BanDroid commented Sep 11, 2023

If you want to use this workaround, just remove this line :

apply plugin: com.itsaky.androidide.gradle.AndroidIDEInitScriptPlugin

i would just comment that line instead of removing it, to be safe.

Edit:
it does work, i will still open this issue cause the temporary workaround is a dirty hack since the logsender cant work with the app.

@BanDroid
Copy link
Member Author

BanDroid commented Oct 2, 2023

in the new latest debug version, everytime syncing will regenerate init.gradle file, and now the build or sync always failed because cannot resolve the repository.

edit:
i think i found the problem, this problem occur if app/build.gradle use old groovy syntax in apply plugin section.

apply plugin: "com.android.application"

that one caused the error in my project, i guess if this used, androidide cant add com.itsaky.androidide plugin, it has to be like this

plugins {
  id "com.android.application"
}

@MrIkso
Copy link
Contributor

MrIkso commented Jan 3, 2024

@itsaky initscript.gradle

   initscript {
     repositories {
       maven {
         mavenCentral()
         
         // Add snapshots repository for AndroidIDE CI builds
         url "https://s01.oss.sonatype.org/content/repositories/snapshots/"
       }
     }
 
     dependencies {
       classpath '${BuildConfig.packageName}:gradle-plugin:${publishingVersion}'
     }
   }
   
   gradle.settingsEvaluated { settings ->
     settings.dependencyResolutionManagement.repositories {
       // For release builds
       mavenCentral()
       
       // For AndroidIDE CI builds
       maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" }
     }
   }
   
   gradle.projectsLoaded {
     rootProject.subprojects.forEach {sub ->
       sub.afterEvaluate {
         sub.apply plugin: com.itsaky.androidide.gradle.AndroidIDEGradlePlugin
       }
     }
   }
   
 ```


Your old code successfully worked for new/old syntax plugins

itsaky added a commit that referenced this issue Jan 12, 2024
@itsaky
Copy link
Member

itsaky commented Jan 15, 2024

Fixed in 2775702.

@itsaky itsaky closed this as completed Jan 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants