Failed to Generate Signed Apk - An organization slug is required (provide with --org)
Asked Answered
B

7

10

After setting up the Sentry.io error tracking I get this error when I try to Generate Signed Apk:

Java Compiler
error: An organization slug is required (provide with --org)

Click on this image and open it to see more details: Error

I cannot understand anything from this one:

Process 'command
'/var/folders/j4/_fzm1rks3tsc2h3j4l2qbq4w0000gn/T/.sentry-cli1369818638611304938.exe'
' finished with non-zero exit value 1

This is the file address that was raised in error: Address in error

How can I solve this problem and Generate Signed Apk?

Bolin answered 19/11, 2018 at 7:14 Comment(0)
E
6

The docs are not a bit clear, though its mentioned but easy to miss it. There are two different sentry.properties required here.

Please note the sentry.properties in your project root that configures sentry-cli is different than the one you include in your application resources to configure the Sentry SDK at runtime (as seen in the configuration documentation).

You need to have another sentry.properties file in the project root with

defaults.project=your-project
defaults.org=your-org
auth.token=YOUR_AUTH_TOKEN

and the runtime sentry.properties with DSN values, etc can be placed in app/src/main/resources directory(create resource directory if required)

Config Docs

Endaendall answered 9/4, 2019 at 4:49 Comment(1)
how to create this file?Hauberk
M
2

You need to upload the Proguard mapping file to the sentry server.

create a file in the root project folder and set name sentry.properties.

defaults.url=https://sentry.io
defaults.org=TEST
defaults.project=TEST_DEV
auth.token=TOKEN

replace TEST, TEST_DEV, and TOKEN.

you can get TOKEN from https://sentry.io/api

if you are use custom sentry server, replace https://sentry.io to your server adddress.

and change file build.gradle

buildscript {
    
    dependencies {

        classpath 'com.android.tools.build:gradle:3.5.2'
        
        classpath 'io.sentry:sentry-android-gradle-plugin:1.7.27'

    }
}

and

apply plugin: 'com.android.application'
apply plugin: 'io.sentry.android.gradle'

...

sentry {
  autoProguardConfig true
  autoUpload true
}
    
android {
  ...
}
dependencies {

     ...

     implementation 'io.sentry:sentry-android:1.7.27'
     implementation 'org.slf4j:slf4j-nop:1.7.25'

     ...
}
Monosaccharide answered 27/11, 2019 at 12:39 Comment(0)
W
1

For ReactNative/iOS, if you have such errors check that you put sentry.properties file in iOS folderenter image description here

Walsh answered 27/7, 2021 at 5:27 Comment(0)
P
0

When you enable Proguard minification, symbols are uploaded to Sentry. This upload is done via the sentry-cli, which is throwing the error. The error says the CLI doesn't know which project within Sentry to associate your symbols with. You need to make sure to go through the gradle integration in the docs. Specifically:

defaults.project=airflow
defaults.org=sentry
auth.token=YOUR_AUTH_TOKEN

Alternatively you can use sentry-cli directly to upload symbols, although the gradle integration is advised.

Predation answered 19/11, 2018 at 9:34 Comment(3)
Exactly I was going to ask a new question about gradle Manual Integration. I used the alternative way by using sentry { autoProguardConfig true autoUpload true } in my app/builed.gradle but the problem is still alive. can you help me to test manual integration?Bolin
If the steps laid out in the doc didn't help, I suggest open an issue on github. The final solution could e added as an answered herePredation
I did it at the same time. I'm waiting for the answer.Bolin
D
0

I also stranded here whilst trying to figure what was going wrong with my sentry source map uploads (not on android, but for web with a similar error). To debug my events that weren't matched, I was using the sentry-cli like so;

Screenshot 2022-06-08 at 10 01 48

So I was searching how I could add the organization slug to my source map uploads. But this error wasn't about the event, but for using the explain CLI functionality itself!!! Which confused me.

I had to pass additional parameters to the CLI script to get the actual problem with the event;

Screenshot 2022-06-08 at 10 04 20

Maybe this will help someone else who also skipped over the docs 😅

Dorotheadorothee answered 8/6, 2022 at 8:12 Comment(0)
S
-2

instead of making

minifyEnabled false

Just add these rules to proguard rules file and keep minifyEnabled true

#sentry
-keepattributes LineNumberTable,SourceFile
-dontwarn org.slf4j.**
-dontwarn javax.**
-keep class io.sentry.event.Event { *; }

That solved my issue without disabling minification

Sexist answered 3/11, 2019 at 12:9 Comment(1)
Thank you for your post. Honestly, it's been a long time since the question I posted and I can't test your answer right now. I urge all other people who read your post to announce their test results.Bolin
B
-5

IT IS NOT A REAL ANSWER But it can solve our problem in the short term by setting false value to minifyEnabled.

app/build.gradle:

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

but it added 1.3MB to the size my of Apk file.

Please let me know if anyone has a different better solution.

Bolin answered 19/11, 2018 at 8:35 Comment(4)
This answer just a prevention for symptoms not cure, this must not've been the accepted answer. By disabling minify you are just building your dev variant and adding all the unnecessary code, its there for a reason. Better look for the solution that fixes the error, not mask it. Read my answer: #53370387Endaendall
@Stacklearner I agree with you, but I asked this question 4 months ago, and I solved it in another way that I do not remember its details now.Bolin
چرا صورت مسئله رو پاک میکنید؟! :)Hauberk
@roghayehhosseini The answer has been updated to describe the type of the solution clearer.Bolin

© 2022 - 2024 — McMap. All rights reserved.