Support
Quality
Security
License
Reuse
kandi has reviewed zxing and discovered the below as its top functions. This is intended to give you an instant insight into zxing implemented functionality, and help decide if they suit your requirements.
ZXing ("Zebra Crossing") barcode scanning library for Java, Android
android:exported needs to be explicitly specified for <activity>. Apps targeting Android 12 and higher are required to specify
<receiver android:name="<name_of_the_entry>"
android:exported="false or true"
tools:node="merge" />
-----------------------
<activity
android:name="<activity which is giving error>"
android:exported="true"
tools:node="merge" />
-----------------------
<activity android:name="name_of_the_activity_inside_library>"
android:exported="false|true"
tools:node="merge" />
-----------------------
debugImplementation "androidx.fragment:fragment-testing:<version>"
androidTestImplementation "androidx.fragment:fragment-testing:<version>"
-----------------------
debugImplementation "androidx.fragment:fragment-testing:<version>"
androidTestImplementation "androidx.fragment:fragment-testing:<version>"
-----------------------
android:exported="true"
-----------------------
androidTestImplementation "androidx.test.ext:junit:1.1.3"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.0.4"
-----------------------
> java.util.concurrent.ExecutionException: com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/xxxxx.tmp/base.apk (at Binary XML file line #129): YOUR.FULLY.QUALIFIED.NAME.FAILING.ACTIVITY: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present
-----------------------
<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity"
android:exported="true"
tools:node="merge"/>
<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity"
android:exported="true"
tools:node="merge"/>
<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity"
android:exported="true"
tools:node="merge"/>
-----------------------
<activity
android:name="com.test.activity.SplashActivity"
android:clearTaskOnLaunch="true"
android:label="@string/app_name"
android:launchMode="singleTop"
android:noHistory="true"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:exported="true">
<receiver
android:name="com.test.receiver.ShareReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.test.fcm.android.action.broadcast" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.tagmanager.InstallReferrerService"
android:exported="true" />
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.razorpay:checkout:1.6.15'
-----------------------
<activity
android:name="com.test.activity.SplashActivity"
android:clearTaskOnLaunch="true"
android:label="@string/app_name"
android:launchMode="singleTop"
android:noHistory="true"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:exported="true">
<receiver
android:name="com.test.receiver.ShareReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.test.fcm.android.action.broadcast" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.tagmanager.InstallReferrerService"
android:exported="true" />
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.razorpay:checkout:1.6.15'
-----------------------
<activity
android:name="com.test.activity.SplashActivity"
android:clearTaskOnLaunch="true"
android:label="@string/app_name"
android:launchMode="singleTop"
android:noHistory="true"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:exported="true">
<receiver
android:name="com.test.receiver.ShareReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.test.fcm.android.action.broadcast" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.tagmanager.InstallReferrerService"
android:exported="true" />
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.razorpay:checkout:1.6.15'
-----------------------
"com.google.dagger:hilt-android:2.38.1"
"com.google.dagger:hilt-android-gradle-plugin:2.38.1"
"com.google.dagger:hilt-android-compiler:2.38.1"
"com.google.dagger:hilt-android-testing:2.38.1"
"com.google.dagger:hilt-android:2.40.5"
"com.google.dagger:hilt-android-gradle-plugin:2.40.5"
"com.google.dagger:hilt-android-compiler:2.40.5"
"com.google.dagger:hilt-android-testing:2.40.5"
-----------------------
"com.google.dagger:hilt-android:2.38.1"
"com.google.dagger:hilt-android-gradle-plugin:2.38.1"
"com.google.dagger:hilt-android-compiler:2.38.1"
"com.google.dagger:hilt-android-testing:2.38.1"
"com.google.dagger:hilt-android:2.40.5"
"com.google.dagger:hilt-android-gradle-plugin:2.40.5"
"com.google.dagger:hilt-android-compiler:2.40.5"
"com.google.dagger:hilt-android-testing:2.40.5"
-----------------------
<receiver
android:name="com.razorpay.RzpTokenReceiver"
android:exported="false">
<intent-filter>
<action android:name="rzp.device_token.share" />
</intent-filter>
</receiver>
<activity
android:name="com.razorpay.CheckoutActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:exported="true"
android:theme="@style/CheckoutTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<data
android:host="rzp.io"
android:scheme="io.rzp" />
</intent-filter>
</activity>
-----------------------
android:exported="true" <!-- or false as required -->
-----------------------
<activity
android:name=".MainActivity"
android:exported="true" <** add this line on AndroidManifest.xml**
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
</activity>
how to make ZxingScanner start scanning?
<zxing:ZXingScannerView x:Name="qrCodeScannerView"
OnScanResult="Handle_OnScanResult"
IsScanning="true"
WidthRequest="1024"
HeightRequest="400" />
public void Handle_OnScanResult(Result scanResult)
{
qrCodeScannerView.IsScanning = false;
// processing scanResult.Text here
}
protected override void OnAppearing()
{
base.OnAppearing();
qrCodeScannerView.IsScanning = true;
}
protected override void OnDisappearing()
{
base.OnDisappearing();
qrCodeScannerView.IsScanning = false;
}
-----------------------
<zxing:ZXingScannerView x:Name="qrCodeScannerView"
OnScanResult="Handle_OnScanResult"
IsScanning="true"
WidthRequest="1024"
HeightRequest="400" />
public void Handle_OnScanResult(Result scanResult)
{
qrCodeScannerView.IsScanning = false;
// processing scanResult.Text here
}
protected override void OnAppearing()
{
base.OnAppearing();
qrCodeScannerView.IsScanning = true;
}
protected override void OnDisappearing()
{
base.OnDisappearing();
qrCodeScannerView.IsScanning = false;
}
-----------------------
private async void ButtonScan(object sender, EventArgs e)
{
PermissionStatus granted = await Permissions.CheckStatusAsync<Permissions.Camera>();
if (granted != PermissionStatus.Granted)
{
_ = await Permissions.RequestAsync<Permissions.Camera>();
}
if (granted == PermissionStatus.Granted)
{
try
{
MobileBarcodeScanner scanner = new MobileBarcodeScanner();
ZXing.Result result = await scanner.Scan();
if (result != null && result.Text != "")
{
//You access your scanned text with result.Text
scanner.Cancel(); // <--- This closes the scanner
}
}
catch (Exception)
{
await DisplayAlert("Problem", "Something went wrong.", "ΟΚ");
}
}
else
{
await DisplayAlert("Problem", "No permissions to use camera.", "ΟΚ");
}
}
ZXing.Mobile.MobileBarcodeScanner.Initialize(Application);
-----------------------
private async void ButtonScan(object sender, EventArgs e)
{
PermissionStatus granted = await Permissions.CheckStatusAsync<Permissions.Camera>();
if (granted != PermissionStatus.Granted)
{
_ = await Permissions.RequestAsync<Permissions.Camera>();
}
if (granted == PermissionStatus.Granted)
{
try
{
MobileBarcodeScanner scanner = new MobileBarcodeScanner();
ZXing.Result result = await scanner.Scan();
if (result != null && result.Text != "")
{
//You access your scanned text with result.Text
scanner.Cancel(); // <--- This closes the scanner
}
}
catch (Exception)
{
await DisplayAlert("Problem", "Something went wrong.", "ΟΚ");
}
}
else
{
await DisplayAlert("Problem", "No permissions to use camera.", "ΟΚ");
}
}
ZXing.Mobile.MobileBarcodeScanner.Initialize(Application);
Unable to create package with jlink
set manual_modules=,jdk.crypto.ec,jdk.localedata,javafx.controls,javafx.fxml,javafx.web,java.sql
zxing qr/barcode scanning using MVVM?
<zxing:ZXingScannerView
IsAnalyzing="{Binding IsAnalyzing}"
IsScanning="{Binding IsScanning}"
OnScanResult="CameraScanner_OnScanResult" />
private void CameraScanner_OnScanResult(ZXing.Result result)
{
((MyViewModel)BindingContext).OnScanComplete(result.Text);
}
-----------------------
<zxing:ZXingScannerView
IsAnalyzing="{Binding IsAnalyzing}"
IsScanning="{Binding IsScanning}"
OnScanResult="CameraScanner_OnScanResult" />
private void CameraScanner_OnScanResult(ZXing.Result result)
{
((MyViewModel)BindingContext).OnScanComplete(result.Text);
}
-----------------------
ViewMode:
private Result bcScanResult;
public Result BcScanResult
{
get => bcScanResult;
set
{
if (value == bcScanResult)
return;
bcScanResult = value;
OnPropertyChanged();
}
}
public AsyncCommand BcScanCommand { get; }
public CodeScanVM()
{
BcScanCommand = new AsyncCommand(BcScanCommand_Call);
}
async Task BcScanCommand_Call()
{
await App.Current.MainPage.DisplayAlert("Item", "Code Async
Command:" + Result, "OK");
return;
}
View:
<zxing:ZXingScannerView
x:Name="ScanView"
Result="{Binding BcScanResult}"
ScanResultCommand="{Binding BcScanCommand }"
IsScanning="True"
WidthRequest="300"
HeightRequest="300"/>
-----------------------
<Button Text="QR Scan"
TextColor="White"
CornerRadius="30"
Clicked="ButtonScan"/>
<Entry BackgroundColor="White"
IsTextPredictionEnabled="False"
TextTransform="Uppercase"
FontSize="Body"
TextChanged="Search"
Placeholder="Search"
TextColor="Black"
PlaceholderColor="Black"
x:Name="lblBarcode"
Keyboard="Chat">
private async void ButtonScan(object sender, EventArgs e)
{
PermissionStatus granted = await Permissions.CheckStatusAsync<Permissions.Camera>();
if (granted != PermissionStatus.Granted)
{
_ = await Permissions.RequestAsync<Permissions.Camera>();
}
if (granted == PermissionStatus.Granted)
{
try
{
MobileBarcodeScanner scanner = new MobileBarcodeScanner();
ZXing.Result result = await scanner.Scan();
if (result != null && result.Text != "")
{
lblBarcode.Text = result.Text; // <--- This places the result of scanner at Entry/Label
scanner.Cancel(); // <--- This closes the scanner
}
}
catch (Exception)
{
await DisplayAlert("Problem", "Something went wrong.", "ΟΚ");
}
}
else
{
await DisplayAlert("Problem", "No permissions to use camera.", "ΟΚ");
}
}
-----------------------
<Button Text="QR Scan"
TextColor="White"
CornerRadius="30"
Clicked="ButtonScan"/>
<Entry BackgroundColor="White"
IsTextPredictionEnabled="False"
TextTransform="Uppercase"
FontSize="Body"
TextChanged="Search"
Placeholder="Search"
TextColor="Black"
PlaceholderColor="Black"
x:Name="lblBarcode"
Keyboard="Chat">
private async void ButtonScan(object sender, EventArgs e)
{
PermissionStatus granted = await Permissions.CheckStatusAsync<Permissions.Camera>();
if (granted != PermissionStatus.Granted)
{
_ = await Permissions.RequestAsync<Permissions.Camera>();
}
if (granted == PermissionStatus.Granted)
{
try
{
MobileBarcodeScanner scanner = new MobileBarcodeScanner();
ZXing.Result result = await scanner.Scan();
if (result != null && result.Text != "")
{
lblBarcode.Text = result.Text; // <--- This places the result of scanner at Entry/Label
scanner.Cancel(); // <--- This closes the scanner
}
}
catch (Exception)
{
await DisplayAlert("Problem", "Something went wrong.", "ΟΚ");
}
}
else
{
await DisplayAlert("Problem", "No permissions to use camera.", "ΟΚ");
}
}
ZXing IntentIntegrator always asks to install Barcode Scanner app
repositories {
mavenCentral()
}
dependencies {
implementation 'com.journeyapps:zxing-android-embedded:4.2.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
}
android {
buildToolsVersion '28.0.3' // Older versions may give compile errors
}
-----------------------
<queries>
<package android:name="com.google.zxing.client.android" />
</queries>
Xamarin.Android Camera Permissions with ZXing.Net.Mobile only works after app restart
using System.Threading.Tasks;
using Xamarin.Essentials;
using static Xamarin.Essentials.Permissions;
public static async Task<PermissionStatus> CheckAndRequestPermissionAsync<TPermission>()
where TPermission : BasePermission, new()
{
TPermission permission = new TPermission();
var status = await permission.CheckStatusAsync();
if (status != PermissionStatus.Granted)
{
status = await permission.RequestAsync();
}
return status;
}
var status = await PermissionsHelper.CheckAndRequestPermissionAsync<Permissions.Camera>();
if(status != PermissionStatus.Granted)
{
return;
}
-----------------------
using System.Threading.Tasks;
using Xamarin.Essentials;
using static Xamarin.Essentials.Permissions;
public static async Task<PermissionStatus> CheckAndRequestPermissionAsync<TPermission>()
where TPermission : BasePermission, new()
{
TPermission permission = new TPermission();
var status = await permission.CheckStatusAsync();
if (status != PermissionStatus.Granted)
{
status = await permission.RequestAsync();
}
return status;
}
var status = await PermissionsHelper.CheckAndRequestPermissionAsync<Permissions.Camera>();
if(status != PermissionStatus.Granted)
{
return;
}
IndexOutOfBounds when encoding a PDF417
BitMatrix bitMatrix = new MultiFormatWriter().encode(mContent, barcodeFormat, mWidth, mHeight, hintsMap);
int realWidth = bitMatrix.getWidth();
int realHeight = bitMatrix.getHeight();
int[] pixels = new int[realWidth * realHeight];
for (int i = 0; i < realHeight; i++) {
for (int j = 0; j < realWidth; j++) {
if (bitMatrix.get(j, i)) {
pixels[i * realWidth + j] = 0x00000000;
} else {
pixels[i * realWidth + j] = 0xffffffff;
}
}
}
Bitmap bitmap = Bitmap.createBitmap(pixels, 0, realWidth, realWidth, realHeight, Bitmap.Config.RGB_565);
Processing Dialog after QR Scan in Xamarin
Device.BeginInvokeOnMainThread(async () =>
{
try
{
using (UserDialogs.Instance.Loading(("Processing")))
{
await Task.Delay(300);
//Your Service code
}
}
catch (Exception ex)
{
var val = ex.Message;
UserDialogs.Instance.Alert("Test", val.ToString(), "Ok");
}
});
-----------------------
try
{
// QR Scan Result
string qr_scan = result.Response;
var result = JsonConvert.DeserializeObject<QRScan>(qr_scan);
await MainThread.InvokeOnMainThreadAsync(() => CreateConnection());
}
catch (Exception error)
{ }
finally
{
// navigate to next page
await NavigationService.NavigateToAsync<NextViewModel>();
}
PDF417 decode and generate the same barcode using Swift
// ...
var keyData = knownKey.data(using: .isoLatin1)!
keyData.append(secretData)
let image = generatePDF417Barcode(from: keyData)
-----------------------
filter.setValue(codeData, forKey: "inputMessage")
filter.setValue(3, forKey: "inputCompactionMode") // This is good (and the big difference)
filter.setValue(5, forKey: "inputDataColumns") // This is fine, but probably unneeded
filter.setValue(0, forKey: "inputCorrectionLevel") // This is bad
cat /tmp/barcode.jpeg | jpegtopnm | ppmtopgm | pamthreshold | pamtopnm > new.pbm && ./pdf417decode -c -e new.pbm
0 7f54 0x02030000 (0) // Left marker
0 6a38 0x00000007 (7) // Number of rows function output
0 218c 0x00000076 (118) // Total number of non-error correcting codewords
0 0211 0x00000385 (901) // Latch to Byte Compaction mode
0 68cf 0x00000059 (89) // Data
0 18ec 0x0000021c (540)
0 02e7 0x00000330 (816)
0 753c 0x00000004 (4) // Number of columns function output
0 7e8a 0x00030001 (1) // Right marker
1 7f54 0x02030000 (0) // Left marker
1 7520 0x00010002 (2) // Security Level function output
1 704a 0x00010334 (820) // Data
1 31f2 0x000101a7 (423)
1 507b 0x000100c9 (201)
1 5e5f 0x00010319 (793)
1 6cf3 0x00010176 (374)
1 7d47 0x00010007 (7) // Number of rows function output
1 7e8a 0x00030001 (1) // Right marker
2 7f54 0x02030000 (0) // Left marker
2 6a7e 0x00020004 (4) // Number of columns function output
2 0fb2 0x0002037a (890) // Data
2 6dfa 0x000200d9 (217)
2 5b3e 0x000200bc (188)
2 3bbc 0x00020180 (384)
2 5e0b 0x00020268 (616)
2 29e0 0x00020002 (2) // Security Level function output
2 7e8a 0x00030001 (1) // Right marker
30 * (n/3) + ((N-1)/3)
30 * (n/3) + 3*e + (N-1) % 3
=> 0 + 3*e + (23%3) = 2
=> 3*e + 2 = 2
=> 3*e = 0
=> e = 0
30 * (n/3) + (c - 1)
=> 0 + c - 1 = 4
=> c = 5
-----------------------
filter.setValue(codeData, forKey: "inputMessage")
filter.setValue(3, forKey: "inputCompactionMode") // This is good (and the big difference)
filter.setValue(5, forKey: "inputDataColumns") // This is fine, but probably unneeded
filter.setValue(0, forKey: "inputCorrectionLevel") // This is bad
cat /tmp/barcode.jpeg | jpegtopnm | ppmtopgm | pamthreshold | pamtopnm > new.pbm && ./pdf417decode -c -e new.pbm
0 7f54 0x02030000 (0) // Left marker
0 6a38 0x00000007 (7) // Number of rows function output
0 218c 0x00000076 (118) // Total number of non-error correcting codewords
0 0211 0x00000385 (901) // Latch to Byte Compaction mode
0 68cf 0x00000059 (89) // Data
0 18ec 0x0000021c (540)
0 02e7 0x00000330 (816)
0 753c 0x00000004 (4) // Number of columns function output
0 7e8a 0x00030001 (1) // Right marker
1 7f54 0x02030000 (0) // Left marker
1 7520 0x00010002 (2) // Security Level function output
1 704a 0x00010334 (820) // Data
1 31f2 0x000101a7 (423)
1 507b 0x000100c9 (201)
1 5e5f 0x00010319 (793)
1 6cf3 0x00010176 (374)
1 7d47 0x00010007 (7) // Number of rows function output
1 7e8a 0x00030001 (1) // Right marker
2 7f54 0x02030000 (0) // Left marker
2 6a7e 0x00020004 (4) // Number of columns function output
2 0fb2 0x0002037a (890) // Data
2 6dfa 0x000200d9 (217)
2 5b3e 0x000200bc (188)
2 3bbc 0x00020180 (384)
2 5e0b 0x00020268 (616)
2 29e0 0x00020002 (2) // Security Level function output
2 7e8a 0x00030001 (1) // Right marker
30 * (n/3) + ((N-1)/3)
30 * (n/3) + 3*e + (N-1) % 3
=> 0 + 3*e + (23%3) = 2
=> 3*e + 2 = 2
=> 3*e = 0
=> e = 0
30 * (n/3) + (c - 1)
=> 0 + c - 1 = 4
=> c = 5
-----------------------
filter.setValue(codeData, forKey: "inputMessage")
filter.setValue(3, forKey: "inputCompactionMode") // This is good (and the big difference)
filter.setValue(5, forKey: "inputDataColumns") // This is fine, but probably unneeded
filter.setValue(0, forKey: "inputCorrectionLevel") // This is bad
cat /tmp/barcode.jpeg | jpegtopnm | ppmtopgm | pamthreshold | pamtopnm > new.pbm && ./pdf417decode -c -e new.pbm
0 7f54 0x02030000 (0) // Left marker
0 6a38 0x00000007 (7) // Number of rows function output
0 218c 0x00000076 (118) // Total number of non-error correcting codewords
0 0211 0x00000385 (901) // Latch to Byte Compaction mode
0 68cf 0x00000059 (89) // Data
0 18ec 0x0000021c (540)
0 02e7 0x00000330 (816)
0 753c 0x00000004 (4) // Number of columns function output
0 7e8a 0x00030001 (1) // Right marker
1 7f54 0x02030000 (0) // Left marker
1 7520 0x00010002 (2) // Security Level function output
1 704a 0x00010334 (820) // Data
1 31f2 0x000101a7 (423)
1 507b 0x000100c9 (201)
1 5e5f 0x00010319 (793)
1 6cf3 0x00010176 (374)
1 7d47 0x00010007 (7) // Number of rows function output
1 7e8a 0x00030001 (1) // Right marker
2 7f54 0x02030000 (0) // Left marker
2 6a7e 0x00020004 (4) // Number of columns function output
2 0fb2 0x0002037a (890) // Data
2 6dfa 0x000200d9 (217)
2 5b3e 0x000200bc (188)
2 3bbc 0x00020180 (384)
2 5e0b 0x00020268 (616)
2 29e0 0x00020002 (2) // Security Level function output
2 7e8a 0x00030001 (1) // Right marker
30 * (n/3) + ((N-1)/3)
30 * (n/3) + 3*e + (N-1) % 3
=> 0 + 3*e + (23%3) = 2
=> 3*e + 2 = 2
=> 3*e = 0
=> e = 0
30 * (n/3) + (c - 1)
=> 0 + c - 1 = 4
=> c = 5
-----------------------
filter.setValue(codeData, forKey: "inputMessage")
filter.setValue(3, forKey: "inputCompactionMode") // This is good (and the big difference)
filter.setValue(5, forKey: "inputDataColumns") // This is fine, but probably unneeded
filter.setValue(0, forKey: "inputCorrectionLevel") // This is bad
cat /tmp/barcode.jpeg | jpegtopnm | ppmtopgm | pamthreshold | pamtopnm > new.pbm && ./pdf417decode -c -e new.pbm
0 7f54 0x02030000 (0) // Left marker
0 6a38 0x00000007 (7) // Number of rows function output
0 218c 0x00000076 (118) // Total number of non-error correcting codewords
0 0211 0x00000385 (901) // Latch to Byte Compaction mode
0 68cf 0x00000059 (89) // Data
0 18ec 0x0000021c (540)
0 02e7 0x00000330 (816)
0 753c 0x00000004 (4) // Number of columns function output
0 7e8a 0x00030001 (1) // Right marker
1 7f54 0x02030000 (0) // Left marker
1 7520 0x00010002 (2) // Security Level function output
1 704a 0x00010334 (820) // Data
1 31f2 0x000101a7 (423)
1 507b 0x000100c9 (201)
1 5e5f 0x00010319 (793)
1 6cf3 0x00010176 (374)
1 7d47 0x00010007 (7) // Number of rows function output
1 7e8a 0x00030001 (1) // Right marker
2 7f54 0x02030000 (0) // Left marker
2 6a7e 0x00020004 (4) // Number of columns function output
2 0fb2 0x0002037a (890) // Data
2 6dfa 0x000200d9 (217)
2 5b3e 0x000200bc (188)
2 3bbc 0x00020180 (384)
2 5e0b 0x00020268 (616)
2 29e0 0x00020002 (2) // Security Level function output
2 7e8a 0x00030001 (1) // Right marker
30 * (n/3) + ((N-1)/3)
30 * (n/3) + 3*e + (N-1) % 3
=> 0 + 3*e + (23%3) = 2
=> 3*e + 2 = 2
=> 3*e = 0
=> e = 0
30 * (n/3) + (c - 1)
=> 0 + c - 1 = 4
=> c = 5
-----------------------
filter.setValue(codeData, forKey: "inputMessage")
filter.setValue(3, forKey: "inputCompactionMode") // This is good (and the big difference)
filter.setValue(5, forKey: "inputDataColumns") // This is fine, but probably unneeded
filter.setValue(0, forKey: "inputCorrectionLevel") // This is bad
cat /tmp/barcode.jpeg | jpegtopnm | ppmtopgm | pamthreshold | pamtopnm > new.pbm && ./pdf417decode -c -e new.pbm
0 7f54 0x02030000 (0) // Left marker
0 6a38 0x00000007 (7) // Number of rows function output
0 218c 0x00000076 (118) // Total number of non-error correcting codewords
0 0211 0x00000385 (901) // Latch to Byte Compaction mode
0 68cf 0x00000059 (89) // Data
0 18ec 0x0000021c (540)
0 02e7 0x00000330 (816)
0 753c 0x00000004 (4) // Number of columns function output
0 7e8a 0x00030001 (1) // Right marker
1 7f54 0x02030000 (0) // Left marker
1 7520 0x00010002 (2) // Security Level function output
1 704a 0x00010334 (820) // Data
1 31f2 0x000101a7 (423)
1 507b 0x000100c9 (201)
1 5e5f 0x00010319 (793)
1 6cf3 0x00010176 (374)
1 7d47 0x00010007 (7) // Number of rows function output
1 7e8a 0x00030001 (1) // Right marker
2 7f54 0x02030000 (0) // Left marker
2 6a7e 0x00020004 (4) // Number of columns function output
2 0fb2 0x0002037a (890) // Data
2 6dfa 0x000200d9 (217)
2 5b3e 0x000200bc (188)
2 3bbc 0x00020180 (384)
2 5e0b 0x00020268 (616)
2 29e0 0x00020002 (2) // Security Level function output
2 7e8a 0x00030001 (1) // Right marker
30 * (n/3) + ((N-1)/3)
30 * (n/3) + 3*e + (N-1) % 3
=> 0 + 3*e + (23%3) = 2
=> 3*e + 2 = 2
=> 3*e = 0
=> e = 0
30 * (n/3) + (c - 1)
=> 0 + c - 1 = 4
=> c = 5
-----------------------
filter.setValue(codeData, forKey: "inputMessage")
filter.setValue(3, forKey: "inputCompactionMode") // This is good (and the big difference)
filter.setValue(5, forKey: "inputDataColumns") // This is fine, but probably unneeded
filter.setValue(0, forKey: "inputCorrectionLevel") // This is bad
cat /tmp/barcode.jpeg | jpegtopnm | ppmtopgm | pamthreshold | pamtopnm > new.pbm && ./pdf417decode -c -e new.pbm
0 7f54 0x02030000 (0) // Left marker
0 6a38 0x00000007 (7) // Number of rows function output
0 218c 0x00000076 (118) // Total number of non-error correcting codewords
0 0211 0x00000385 (901) // Latch to Byte Compaction mode
0 68cf 0x00000059 (89) // Data
0 18ec 0x0000021c (540)
0 02e7 0x00000330 (816)
0 753c 0x00000004 (4) // Number of columns function output
0 7e8a 0x00030001 (1) // Right marker
1 7f54 0x02030000 (0) // Left marker
1 7520 0x00010002 (2) // Security Level function output
1 704a 0x00010334 (820) // Data
1 31f2 0x000101a7 (423)
1 507b 0x000100c9 (201)
1 5e5f 0x00010319 (793)
1 6cf3 0x00010176 (374)
1 7d47 0x00010007 (7) // Number of rows function output
1 7e8a 0x00030001 (1) // Right marker
2 7f54 0x02030000 (0) // Left marker
2 6a7e 0x00020004 (4) // Number of columns function output
2 0fb2 0x0002037a (890) // Data
2 6dfa 0x000200d9 (217)
2 5b3e 0x000200bc (188)
2 3bbc 0x00020180 (384)
2 5e0b 0x00020268 (616)
2 29e0 0x00020002 (2) // Security Level function output
2 7e8a 0x00030001 (1) // Right marker
30 * (n/3) + ((N-1)/3)
30 * (n/3) + 3*e + (N-1) % 3
=> 0 + 3*e + (23%3) = 2
=> 3*e + 2 = 2
=> 3*e = 0
=> e = 0
30 * (n/3) + (c - 1)
=> 0 + c - 1 = 4
=> c = 5
How to properly set options for ZXingScannerView?
public ScanPage()
{
InitializeComponent();
scanView.Options = opts;
}
QUESTION
Firebase crashlytics not able to read crash reports
Asked 2022-Apr-11 at 14:08I have configured crashlytics as per Firebase Documentation https://firebase.google.com/docs/crashlytics/get-started?platform=android. But crash reports not generated and uploaded to server.
Kindly refer my build details.
Here is our project-level build.gradle
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io'}
maven{ url 'https://maven.google.com/' }
mavenCentral()
flatDir {
dirs 'libs'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(:app)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.XXX.XXX"
minSdkVersion 21
targetSdkVersion 28
versionCode 375
versionName "2.25.1"
multiDexEnabled true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
dataBinding {
enabled = true
}
signingConfig signingConfigs.config
}
android {
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
flavorDimensions "appVariant", "projectCode"
productFlavors {
A {
applicationId 'com.XXX.A'
dimension "appVariant"
}
B {
applicationId 'com.XXX.B'
dimension "appVariant"
}
C {
applicationId 'com.XXX.C'
dimension "appVariant"
}
D {
applicationId 'com.XXX.D'
dimension "appVariant"
}
DEV {
dimension "projectCode"
}
QA {
dimension "projectCode"
}
LIVE {
dimension "projectCode"
}
DEMO {
dimension "projectCode"
}
BETA {
dimension "projectCode"
}
}
applicationVariants.all { variant ->
variant.outputs.all { output ->
def project = "XXX"
def SEP = "_"
def flavor = variant.productFlavors[0].name
def projcode = variant.productFlavors[1].name
def buildType = variant.buildType.name
def buildTypeName = "";
switch (buildType) {
case "ABC": buildTypeName = SEP + "AB"; break;
case "XYZ": buildTypeName = SEP + "XY"; break;
default:
buildTypeName = "";
}
def version = variant.versionName
def newApkName = project + buildTypeName + SEP + flavor + SEP + projcode + SEP + version + ".apk"
outputFileName = new File(newApkName)
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
buildConfigField "String", "AREA", "\"\""
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
buildConfigField "String", "AREA", "\"\""
}
ABC {
signingConfig signingConfigs.config
minifyEnabled false
buildConfigField "String", "AREA", "\"_A\""
}
XYZ {
signingConfig signingConfigs.config
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
buildConfigField "String", "AREA", "\"_X\""
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
def room_version = "1.1.1"
def lifecycle_version = "1.1.1"
def work_version = "1.0.0-beta01"
implementation files('libs/commons-net-3.3.jar')
implementation files('libs/httpclient-4.3.4.jar')
implementation files('libs/httpcore-4.3.2.jar')
implementation files('libs/httpmime-4.3.4.jar')
implementation files('libs/silipmlib.jar')
implementation files('libs/HyperLogLib8.jar')
// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:29.3.0')
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-messaging'
//dependency for Workmanager
implementation 'androidx.work:work-runtime:2.0.1'
//dependencies for Room database
implementation 'androidx.room:room-runtime:2.0.0'
//noinspection GradleCompatible
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
annotationProcessor 'androidx.room:room-compiler:2.0.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
//dependency for custom progress dialog
//dependency for retrofit
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
//dependency for joda time for date time calculation
implementation 'joda-time:joda-time:2.10'
//dependency for glide
implementation 'com.github.bumptech.glide:glide:3.7.0'
//dependency for custom toast
implementation 'com.valdesekamdem.library:md-toast:0.9.0'
//dependency for marshmallow permission - dexter library
implementation 'com.karumi:dexter:4.2.0'
// ViewModel and LiveData
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.0.0'
// alternately - if using Java8, use the following instead of compiler
implementation 'androidx.lifecycle:lifecycle-common-java8:2.0.0'
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation project(':floatingmenu')
implementation project(':html2bitmap')
debugImplementation 'com.amitshekhar.android:debug-db:1.0.4'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'com.github.vipulasri:timelineview:1.0.6'
implementation 'me.relex:circleindicator:1.2.2@aar'
implementation 'com.haozhang.libary:android-slanted-textview:1.2'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
// implementation 'com.google.android.gms:play-services-gcm:11.8.0'
// implementation 'com.google.android.gms:play-services-ads:11.8.0'
implementation('com.github.florent37:materialviewpager:1.2.3') {
exclude group: 'com.android.support'
}
implementation 'com.orhanobut:dialogplus:1.11@aar'
// implementation 'me.dm7.barcodescanner:zbar:1.8.4'
implementation 'me.dm7.barcodescanner:zxing:1.9'
implementation 'com.journeyapps:zxing-android-embedded:2.3.0@aar'
implementation 'com.journeyapps:zxing-android-legacy:2.3.0@aar'
implementation 'com.journeyapps:zxing-android-integration:2.3.0@aar'
implementation 'com.google.zxing:core:3.2.0'
implementation 'net.cachapa.expandablelayout:expandablelayout:2.9.2'
implementation 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
implementation files('libs/HyperLogLib8.jar')
implementation project(':scandecode-release')
implementation 'com.tt:whorlviewlibrary:1.0.3'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'io.reactivex:rxjava:1.1.6'
implementation 'com.jakewharton.rxbinding:rxbinding:0.4.0'
implementation 'com.jakewharton.rxbinding:rxbinding-design:0.4.0'
implementation 'org.apache.commons:commons-text:1.7'
// these are for retrolambda and streams api
implementation 'com.annimon:stream:1.1.2'
}
With initialisation:
FirebaseApp.initializeApp(this)
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true)
And manifest:
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="true" />
Here is the logcat for the Crashlytics/CrashTest crash:
2022-04-10 15:53:07.717 21310-21310/com.XXX.XXX E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.XXX.XXX, PID: 21310
java.lang.RuntimeException: Test Crash
at com.XXX.XXX.UI.HomeActivity$1.onClick(HomeActivity.java:345)
at android.view.View.performClick(View.java:6392)
at android.view.View$PerformClick.run(View.java:25133)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:198)
at android.app.ActivityThread.main(ActivityThread.java:7055)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:523)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:836)
This is the log that we receive when app relaunched after crash.
D:\user\Android Projects\XXX>adb logcat -s FirebaseCrashlytics
--------- beginning of main
--------- beginning of system
--------- beginning of crash
04-10 15:54:56.911 22018 22018 I FirebaseCrashlytics: Initializing Firebase Crashlytics 18.2.9 for com.XXX.XXX
04-10 15:54:56.926 22018 22018 D FirebaseCrashlytics: Crashlytics automatic data collection ENABLED by API.
04-10 15:54:56.940 22018 22018 D FirebaseCrashlytics: AnalyticsConnector now available.
04-10 15:54:56.943 22018 22018 D FirebaseCrashlytics: Registered Firebase Analytics listener.
04-10 15:54:56.948 22018 22018 D FirebaseCrashlytics: Mapping file ID is: 00000000000000000000000000000000
04-10 15:54:56.958 22018 22018 D FirebaseCrashlytics: Checking for cached settings...
04-10 15:54:56.992 22018 22018 D FirebaseCrashlytics: Loaded cached settings: {"settings_version":3,"cache_duration":86400,"features":{"collect_logged_exceptions":true,"collect_reports":
true,"collect_analytics":false,"prompt_enabled":false,"push_enabled":false,"firebase_crashlytics_enabled":false,"collect_anrs":true,"collect_metric_kit":false},"app":{"status":"activated
","update_required":false,"report_upload_variant":2,"native_report_upload_variant":2},"fabric":{"org_id":"62513aa60277ea5e0396d4ef","bundle_id":"com.XXX.XXX"},"on_demand_
upload_rate_per_minute":10,"on_demand_backoff_base":1.2,"on_demand_backoff_step_duration_seconds":60,"expires_at":1649666891559}
04-10 15:54:56.996 22018 22018 D FirebaseCrashlytics: Crashlytics automatic data collection ENABLED by API.
04-10 15:54:57.113 22018 22018 D FirebaseCrashlytics: Successfully configured exception handler.
04-10 15:54:57.116 22018 22049 D FirebaseCrashlytics: Opening a new session with ID 6252B07803E20001560228F94565CB5E
04-10 15:54:57.183 22018 22049 D FirebaseCrashlytics: Registered Firebase Analytics event receiver for breadcrumbs
04-10 15:54:58.013 22018 22018 D FirebaseCrashlytics: Crashlytics automatic data collection ENABLED by API.
04-10 15:54:58.642 22018 22018 D FirebaseCrashlytics: Crashlytics automatic data collection ENABLED by API.
These are set to false in cached settings:
"collect_analytics":false,
"firebase_crashlytics_enabled":false,
This setting was weird. Both of them are false for some reason though I never did turn them off explicitly. Never even played with these settings.
Not sure what is wrong. Any help will be appreciated.
ANSWER
Answered 2022-Apr-11 at 14:08Solved!..
There was another utility logger library initialized in the application class that prevented crashlytics from collecting log.
https://github.com/hypertrack/hyperlog-android
Also the initialization & manifest part is not necessary unless you want to explicitly enable/disable crashlytics working.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
No vulnerabilities reported
Save this library and start creating your kit
Explore Related Topics
Save this library and start creating your kit