talsec / Free-RASP-Android

Library for improving app security and threat monitoring on Android mobile devices.
https://github.com/talsec/Free-RASP-Community
MIT License
152 stars 12 forks source link

"Could not find com.aheaditec.talsec.security:TalsecSecurity-Community:3.1.0-dev." with 403 on pom file #3

Closed lcuis closed 2 years ago

lcuis commented 2 years ago

Hi,

I tried following the instructions in #2 .

I reached a point where the compilation error was partially understandable.

Here is the important portion of my android/build.gradle file:

buildscript {
    ext.kotlin_version = '1.5.21'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.aheaditec.talsec.security:TalsecSecurity-Community:3.1.0-dev'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        {url "[https://nexus3-public.monetplus.cz/repository/ahead-talsec-free-rasp]" }
    }
}
...

And here is the complete unedited run output with the error message:

Launching lib/main.dart on SM A037F in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find com.aheaditec.talsec.security:TalsecSecurity-Community:3.1.0-dev.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/aheaditec/talsec/security/TalsecSecurity-Community/3.1.0-dev/TalsecSecurity-Community-3.1.0-dev.pom
       - https://jcenter.bintray.com/com/aheaditec/talsec/security/TalsecSecurity-Community/3.1.0-dev/TalsecSecurity-Community-3.1.0-dev.pom
     Required by:
         project :

* 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

BUILD FAILED in 6s
Exception: Gradle task assembleDebug failed with exit code 1

When I try to open the pom file https://jcenter.bintray.com/com/aheaditec/talsec/security/TalsecSecurity-Community/3.1.0-dev/TalsecSecurity-Community-3.1.0-dev.pom directly, I get this output:

403 Forbidden
nginx

Is there a way to gain access to this file and any other relevant ones?

Or, is there a convenient way to use the aar files without creating a module?

talsec-app commented 2 years ago

Hi @lcuis, There are multiple issues in your build.gradle. The main issue is in your buildscript dependencies. Talsec is not a buildscript dependency. You should remove the following line:

 classpath 'com.aheaditec.talsec.security:TalsecSecurity-Community:3.1.0-dev'

Another issue is the incorrect definition of repository in allprojects. You are missing the maven before the url, and the url shouldn't contain brackets.

Repository definition in allprojects should look like this:

allprojects {
    repositories {
        google()
        jcenter()
        maven {url "https://nexus3-public.monetplus.cz/repository/ahead-talsec-free-rasp" }
    }
}

Your project's build.gradle should finally look like this:

buildscript {
    ext.kotlin_version = '1.5.21'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.2.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {url "https://nexus3-public.monetplus.cz/repository/ahead-talsec-free-rasp" }
    }
}

The dependency com.aheaditec.talsec.security:TalsecSecurity-Community:3.1.0-dev should be in your module's build.gradle (a different file!) in the dependencies section.

And it should be like this:

[build.gradle (:app)]
...

dependencies {
    implementation 'com.aheaditec.talsec.security:TalsecSecurity-Community:3.1.0-dev'
    ...

If you are still unsure about the integration, DM us: info@talsec.app, and we can assist you.

Note: jcenter() repository is deprecated and we recommend to use mavenCentral() instead.

lcuis commented 2 years ago

Thanks you very much for your reply. I am looking forward to trying this!

lcuis commented 2 years ago

I confirm I can build, thanks!