Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8235841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:57:07+00:00 2026-06-07T18:57:07+00:00

As far as I know, in android release build is signed APK. How to

  • 0

As far as I know, in android “release build” is signed APK. How to check it from code or does Eclipse has some kinda of secret defines?

I need this to debug populating ListView items from web service data (no, logcat not an option).

My thoughts:

  • Application’s android:debuggable, but for some reason that doesn’t look reliable.
  • Hard-coding device ID isn’t good idea, because I am using same device for testing signed APKs.
  • Using manual flag somewhere in code? Plausible, but gonna definitely forget to change at some time, plus all programmers are lazy.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T18:57:09+00:00Added an answer on June 7, 2026 at 6:57 pm

    There are different way to check if the application is build using debug or release certificate, but the following way seems best to me.

    According to the info in Android documentation Signing Your Application, debug key contain following subject distinguished name: “CN=Android Debug,O=Android,C=US“. We can use this information to test if package is signed with debug key without hardcoding debug key signature into our code.

    Given:

    import android.content.pm.Signature;
    import java.security.cert.CertificateException;
    import java.security.cert.X509Certificate;
    

    You can implement an isDebuggable method this way:

    private static final X500Principal DEBUG_DN = new X500Principal("CN=Android Debug,O=Android,C=US");
    private boolean isDebuggable(Context ctx)
    {
        boolean debuggable = false;
    
        try
        {
            PackageInfo pinfo = ctx.getPackageManager().getPackageInfo(ctx.getPackageName(),PackageManager.GET_SIGNATURES);
            Signature signatures[] = pinfo.signatures;
    
            CertificateFactory cf = CertificateFactory.getInstance("X.509");
    
            for ( int i = 0; i < signatures.length;i++)
            {   
                ByteArrayInputStream stream = new ByteArrayInputStream(signatures[i].toByteArray());
                X509Certificate cert = (X509Certificate) cf.generateCertificate(stream);       
                debuggable = cert.getSubjectX500Principal().equals(DEBUG_DN);
                if (debuggable)
                    break;
            }
        }
        catch (NameNotFoundException e)
        {
            //debuggable variable will remain false
        }
        catch (CertificateException e)
        {
            //debuggable variable will remain false
        }
        return debuggable;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My Android phone has never crashed as far as I know in the two
As far as i know, Android emulator doesn't have a camera. To capture a
As far as I know, Google C2DM servers gives notifications from third party server.
As far as I know, Android kills an application after sometime if the user
I'm a bit of a first-timer to Android, but as far as I know,
As far as I know, fromhtml of Android can recognize a few HTML tags
as far as I know, there is no simple way in Android to generate
I'm pretty new to eclipse and Android and I'm trying to add some files
I don't exactly know how android updates the applications. As far as I've read
As far as I know we can create notifications in Android using Notification Manager

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.