Samsung Zirconia Protection crash - android

I have to publish a paid app on Samsung Apps, so I have tried to implement Zirconia license management protection for Android, following the guide on the official Samsung Developer Site.
I have added the Zirconia.jar library to the build path, and the armeabi folder with the file libnativeinterface.so in the libs folder of the project.
When I try to run this simple test project
class MyLicenseCheckListener implements LicenseCheckListener {
public void licenseCheckedAsValid() {
Log.d("ZirconiaTest", "License is valid");
ownerHandler.post(new Runnable() {
public void run() {
ownerTextView.setText("Licenza verificata correttamente");
}
});
}
public void licenseCheckedAsInvalid() {
Log.d("ZirconiaTest", "License is invalid");
ownerHandler.post(new Runnable() {
public void run() {
ownerTextView.setText("Licenza non valida");
}
});
}
Handler ownerHandler;
TextView ownerTextView;
}
public class ZirconiaTest extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Handler handler = new Handler();
TextView tv = new TextView(this);
tv.setText( "This is a simple test application for Zirconia!\nPlease hold on while verifying the license..." );
setContentView(tv);
Zirconia zirconia = new Zirconia(this);
zirconia.doVariablesTest();
MyLicenseCheckListener listener = new MyLicenseCheckListener();
listener.ownerHandler = handler;
listener.ownerTextView = tv;
//zirconia.setBogusIMEI("");
zirconia.setLicenseCheckListener(listener);
zirconia.checkLicense(false, false);
zirconia.doVariablesTest();
}
}
I get this error and app crashes
01-04 22:09:23.519: E/dalvikvm(28775): Could not find class 'com.samsung.zirconia.Zirconia', referenced from method com.samsung.zirconia.test.ZirconiaTest.onCreate
01-04 22:09:23.519: W/dalvikvm(28775): VFY: unable to resolve new-instance 9 (Lcom/samsung/zirconia/Zirconia;) in Lcom/samsung/zirconia/test/ZirconiaTest;
What is wrong?

Oh, i had this error too. Here is solution :
Drag "Zirconia.jar" file and drop this into "libs" folder in your project, in Eclipse. Don't delete this from bulid path ! I attached photo for you. I hope I helped

This is an old question which I had forgotten.
This problem was caused by a corrupted Eclipse cache, deleting .metadata folder and recompiling the project the issue gone away.

Related

Why is my native android code in Flutter showing errors?

I am testing platform specific coding with Flutter. I opened the android folder in Android Studio, wrote my code and it shows no errors. I then moved back to Flutter which is underlining in red the Rs in the code below. However, the app is working fine. I am wondering why an error is showing and what I can do to remove these red lines. I would be grateful for pointers.
Here is my code:
public class MyTileService extends TileService {
private final int STATE_ON = 1;
private final int STATE_OFF = 0;
private int toggleState = STATE_ON;
#Override
public void onTileAdded() {
System.out.println("onTileAdded");
}
#Override
public void onTileRemoved() {
System.out.println("onTileRemoved");
}
#Override
public void onStartListening() {
System.out.println("onStartListening");
}
#Override
public void onStopListening() {
System.out.println("onStopListening");
}
#Override
public void onClick() {
System.out.println("onClick state = " + Integer.toString(getQsTile().getState()));
Icon icon;
if (toggleState == STATE_ON) {
toggleState = STATE_OFF;
icon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spa_black_24dp);
System.out.println("OFF");
} else {
toggleState = STATE_ON;
icon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_star_border_black_24dp);
System.out.println("ON");
}
getQsTile().setIcon(icon);
getQsTile().updateTile();
}
}
I tried cleaning the android project, uninstalling and reinstalling Flutter and Dart plugins, checking flutter doctor.
Here is an image:
Flutter projects are not Gradle-based Android projects so a number of
features provided by Android Studio are not available to Flutter
programmers.
This still is a Flutter Plugin.
Is documented here:
https://github.com/flutter/flutter-intellij/issues/2262
And you can track it here:
https://github.com/flutter/flutter-intellij/issues/2243
It seems that the first item is check, so it's only a metter of time to wait this milestone to be released.

Unable to read data in AWS android mobile while using DynamoDB

I started to develop an android app using Amazon Mobile hub (my first time) and Android Studio 3.0.1, and I tried to follow the tutorials
But I keep on getting errors like:
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMappingException: No method annotated with interface com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBRangeKey for class class com.amazonaws.models.nosql.ParkInfoDO.
I have a
table park_info
partition key:park_id
Is there something wrong with my code?
public void readData() {
final IdentityManager identityManager = IdentityManager.getDefaultIdentityManager();
new Thread(new Runnable() {
#Override
public void run() {
ParkInfoDO parkItem = dynamoDBMapper.load(
ParkInfoDO.class,
identityManager.getCachedUserID(),
"P");
// Item read
Log.d("Park Item:", parkItem.toString());
}
}).start();
}

QR code reader to extract data

i have a sales summary print out and has a QR Code ,
i want to develop an app (IOS and android) that reads the QR code , extract all information,do some calculations,and display in specific form , i tried zxing library but it did not extract all information from the receipt.any tip?
You can use google vision API to achieve this. I personally used this and found it great. The below code snippets should help you.
Put this below line in the gradle.
compile 'com.google.android.gms:play-services:9.4.0'
Use BarcodeDetector and CameraSource classes to capture the QR code on real time and decode it.
barcodeDetector.setProcessor(new Detector.Processor<Barcode>() {
#Override
public void release() {
}
#Override
public void receiveDetections(Detector.Detections<Barcode> detections) {
final SparseArray<Barcode> barcodes = detections.getDetectedItems();
if (barcodes.size() != 0) {
barcodeInfo.post(new Runnable() { // Use the post method of the TextView
public void run() {
barcodeInfo.setText( // Update the TextView
barcodes.valueAt(0).displayValue
);
}
});
}
}
});
Use a SparseArray to fetch the detections and the displayValue of the elements of this sparse array returns the deocded string.
After extracting the string one can do anything, be it displaying the string or make some calculation out of it etc.
This library is the most popular and easiest of reading QR codes in your Android application.
You should also have a look at the Wiki section of this library for learning about how to integrate this library into your Android Application and how to use this library.
This is how you can use this library.
1. Add this library to your project by adding following line into your dependencies inside build.gradle(Module: app) file
compile 'com.github.nisrulz:qreader:2.0.0'
2. Then, after syncing project files, add the SurfaceView element provided by this library into your XML layout file.
<SurfaceView
android:id="#+id/camera_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
3. Declare the SurfaceView & QREader inside your Activity's Java file & then initialize it inside onCreate() method.
class MainActivity extends AppCompatActivity{
private SurfaceView mySurfaceView;
private QREader qrEader;
#Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Setup SurfaceView
// -----------------
mySurfaceView = (SurfaceView) findViewById(R.id.camera_view);
// Init QREader
// ------------
qrEader = new QREader.Builder(this, mySurfaceView, new QRDataListener() {
#Override
public void onDetected(final String data) {
Log.d("QREader", "Value : " + data);
text.post(new Runnable() {
#Override
public void run() {
text.setText(data);
}
});
}
}).facing(QREader.BACK_CAM)
.enableAutofocus(true)
.height(mySurfaceView.getHeight())
.width(mySurfaceView.getWidth())
.build();
}
4. Initialize it inside onResume()
#Override
protected void onResume() {
super.onResume();
// Init and Start with SurfaceView
// -------------------------------
qrEader.initAndStart(mySurfaceView);
}
There are many more possibilities you can do with this library, so I recommend you to visit the GitHub repository and check it out. It's worth a shot!

Android Studio cannot resolve symbol BaseDemoActivity

I'm trying to run some Google Drive sample code from the Android Developers website but I'm getting a number of instances where Android Studio cannot resolve method. I think most of the problem might be attributed to BaseDemoActivity also not being recognized. I've gone through the setup process to make sure I have everything correct and as far as I can see it is, I even just this morning updated my Google Play Services version in case it was that but still nothing. Can someone point me in the right direction of how I might fix this?
/**
* An activity to illustrate how to create a new folder.
*/
public class CreateFolderActivity extends BaseDemoActivity {
#Override
public void onConnected(Bundle connectionHint) {
super.onConnected(connectionHint);
MetadataChangeSet changeSet = new MetadataChangeSet.Builder()
.setTitle("New folder").build();
Drive.DriveApi.getRootFolder(getGoogleApiClient()).createFolder(
getGoogleApiClient(), changeSet).addResultCallback(folderCreatedCallback);
}
ResultCallback<DriveFolderResult> folderCreatedCallback = new
ResultCallback<DriveFolderResult>() {
#Override
public void onResult(DriveFolderResult result) {
if (!result.getStatus().isSuccess()) {
showMessage("Error while trying to create the folder");
return;
}
showMessage("Created a folder: " + result.getDriveFolder().getDriveId());
}
}
}
BaseDemoActivity is not part of the API, its just used in the samples. Make sure you have that class copied into your app from the sample.

My app gets "Force close" on several devices

I have people complaining my application gets FC when they launch it (meanwhile others never had a single problem). Here is my full activity source. Since it happens on devices I don't own I can not fix it. From what they tell me it doesn't work on: Motorola Blackflip, Motorola Dext, Motorola CLIQ XT. Guess Motorola doesn't like my app after all...
Could it be that I allow a minSdkVersion="3"? I tested 1.5 on the emulator and worked fine...
Thank you in advance for your responses.
public class workit extends Activity implements OnClickListener {
Button yay;
Button yay0;
Button yay1;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
yay = (Button) findViewById(R.id.gostart);
yay.setOnClickListener(this);
yay0 = (Button) findViewById(R.id.dontstart);
yay0.setOnClickListener(this);
yay1 = (Button) findViewById(R.id.exit);
yay1.setVisibility(ImageView.GONE);
ImageView inizio = (ImageView)findViewById(R.id.start);
inizio.setVisibility(ImageView.VISIBLE);
inizio.setBackgroundResource(R.drawable.start);
}
public void onClick(View v) {
// TODO Auto-generated method stub
if (v == yay0) {
finish();
}
if (v == yay) {
ImageView inizio = (ImageView)findViewById(R.id.start);
inizio.setVisibility(ImageView.GONE);
WebView work = new WebView(this);
setContentView(work);
work.loadUrl("file:///android_asset/index1.html");
work.setWebViewClient( new work());
work.setBackgroundColor(0);
work.getSettings().setBuiltInZoomControls(true);
work.getSettings().setDefaultZoom(ZoomDensity.FAR);
}
if (v == yay1) {
finish();
}
}
private class work extends WebViewClient {
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.contains("exit.html")) {
// TODO: do what you have to do
finish();
}
view.loadUrl(url);
return true;
}
}
}
Your best bet is to ask somebody to send you the LogCollector output (in my experience, users are very happy to provide you information to debug problems. There are some really cool people out there). That should give you a callstack, and information on what kind of exception you triggered (NullPointerException, etc).
Next up - what are you building your app against? There should be an "Android x.x" entry in your project structure somewhere. If you're building something that is supposed to run on Android 1.5, then make sure you actually build against 1.5. You CAN build against 2.0 if you want, but if you need to use 2.0-specific functions, you'll have to encapsulate them properly. (This has been explained in detail on stackoverflow several times.)
On an unrelated note - I recommend more informative variable names. "yay0" doesn't mean anything to anyone who hasn't been working intimately with the code for a while.

Categories

Resources