{"id":8731,"date":"2022-03-30T18:04:34","date_gmt":"2022-03-30T18:04:34","guid":{"rendered":"https:\/\/blogs.aaddevsup.xyz\/?p=8731"},"modified":"2022-08-08T20:39:34","modified_gmt":"2022-08-08T20:39:34","slug":"package-inspector-for-msal-android-native-guide","status":"publish","type":"post","link":"https:\/\/blogs.aaddevsup.xyz\/2022\/03\/package-inspector-for-msal-android-native-guide\/","title":{"rendered":"Package Inspector for MSAL Android Native Guide"},"content":{"rendered":"\n
The Microsoft Authentication Library (MSAL) for Android Native contains a tool called Package Inspector. This tool presents a list of packages installed on an Android device and allows the user to view, copy, and paste the signature hash used to sign the application’s package. It can be very useful in troubleshooting and verifying the signature hash for applications installed on an Android device. Below is a guide on the installation, use, and common issues of the Package Inspector.<\/p>\n\n\n\n
Some scenarios where the Package Inspector will be useful are:<\/p>\n\n\n\n
Note: The best place to learn about MSAL for Android Native is the github page at the following link. The readme is a very good start. You should have:<\/p>\n\n\n\n Option 1: Clone the repository directly into Android Studio<\/strong><\/p>\n\n\n\n Problems loading the tool into Android Studio:<\/strong> Make sure that the project you are loading into Android Studio is not package-inspector, but should be named this: Not all packages appear in the Package Inspector:<\/strong> An explanation for the reason behind this can be found in Google’s documentation on a change that was introduced in Android 11 (API 30): How to fix it – <\/em>
https:\/\/github.com\/AzureAD\/microsoft-authentication-library-for-android<\/a><\/em><\/p>\n\n\n\nPrerequisites<\/h2>\n\n\n\n
Android Studio comes with an AVD manager. You can find more info here:
https:\/\/developer.android.com\/studio\/run\/managing-avds<\/a><\/li>
https:\/\/developer.android.com\/studio\/debug\/dev-options<\/a><\/li>Installation<\/h2>\n\n\n\n
<\/li>
https:\/\/github.com\/AzureAD\/microsoft-authentication-library-for-android.git<\/em>
and click “Clone
<\/li><\/ol>\n\n\n\n
Option 2: Download as a zip file and open in Android Studio<\/strong><\/p>\n\n\n\n
https:\/\/github.com\/AzureAD\/microsoft-authentication-library-for-android\/archive\/refs\/heads\/dev.zip<\/a><\/em><\/li>
<\/li>
<\/li><\/ol>\n\n\n\nUsing the Package Inspector<\/h2>\n\n\n\n
<\/li>
<\/li><\/ol>\n\n\n\nCommon Issues<\/h2>\n\n\n\n
It is very important to make sure that you are loading the root package from the MSAL repository and not individually the package inspector. <\/p>\n\n\n\n
“microsoft-authentication-library-for-android-dev” or whatever you may have renamed the root repository on your system. See step 4 under Option 2 of the installation section of this blog post.<\/p>\n\n\n\n
This is a very likely issue to run into. You are able to install and open Package Inspector fine, and a list of packages appear in the app; however, you do not see packages for any of the apps you have installed on the device.<\/p>\n\n\n\n
https:\/\/developer.android.com\/training\/package-visibility<\/a><\/p>\n\n\n\n
The way to fix the issue is to first open the AndroidManifest.xml file within the ‘package-inspector’ directory found on the left side of Android Studio.<\/p>\n\n\n\n