Java Question Dificult using an external .aar library

abilio486software

Member
Licensed User
Hello,

I'm trying to integrate a MyPOS terminal payment SDK without success.

At this moment I'm getting a compile error when include the .aar library:

"Generating R file. Error
C:\Android\tools\..\extras\b4a_local\unpacked-slavesdk-release-63698443706298\res\values\values.xml:137: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.NoActionBar'.
C:\Android\tools\..\extras\b4a_local\unpacked-slavesdk-release-63698443706298\res\values\values.xml:140: error: Error: No resource found that matches the given name: attr 'colorAccent'."

I include the simple project hopping to get your precious help :)

What I'm doing wrong?

Many thanks
 

Attachments

DonManfred

Expert
Licensed User
1. Developerquestions should be posted in the java questions forum
2. Add Appcompat to your app (based on the error you are not using it).
3. You are missing all the needed permissions for the AAR
4. You are missing RuntimePermissions and the Requests for all the needed Permissions.
5. You are missing the additional Activities which are defined in the AAR.
6. The correct way to export a Project is to use File-Export as ZIP.
 
Last edited:

abilio486software

Member
Licensed User
1. Developerquestions should be posted in the java questions forum
2. Add Appcompat to your app (based on the error you are not using it).
3. You are missing all the needed permissions for the AAR
4. You are missing RuntimePermissions and the Requests for all the needed Permissions.
5. You are missing the additional Activities which are defined in the AAR.
6. The correct way to export a Project is to use File-Export as ZIP.

Hi,

May thanks!

Sorry but don't find specific Java forum for B4A.

For some reason I'm still getting this two errors:

C:\Android\tools\..\extras\b4a_local\unpacked-slavesdk-release-63698443706298\res\values\values.xml:147: error: Error: No resource found that matches the given name: attr 'layout_columnWeight'.
C:\Android\tools\..\extras\b4a_local\unpacked-slavesdk-release-63698443706298\res\values\values.xml:146: error: Error: No resource found that matches the given name: attr 'layout_rowWeight'.


Probably I'm doing something wrong.

Could you take a look in the updated project attached?

Thanks again :)
 

Attachments

abilio486software

Member
Licensed User
I tryed these steps:

- instead of using the .aar, I have unzip it and use the classes.jar
- Move the library res folder to AditionalRes;
- Change the res/values.xls, changing those two xml layour parameters

Example now compile without errors.

But when I try to connect to the terminal, at runtime I get this error:

"Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mypos.slavesdk.R$layout" on path: DexPathList[[zip file "/data/app/b4a.example-OuVR1rV5D6tcq-douDcfTQ==/base.apk"],nativeLibraryDirectories=[/data/app/b4a.example-OuVR1rV5D6tcq-douDcfTQ==/lib/arm64, /system/lib64, /vendor/lib64]]"

I think that the library is trying to open its own connection activity.

In fact I didn't copy the R.txt file.

Is this an error because it's missing the library R.txt ?

Any strategy to bypass this error?
 

Attachments

abilio486software

Member
Licensed User
Solved!

It was necessary to compile with these parameters:

compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:gridlayout-v7:25.0.1'
compile 'com.android.support:cardview-v7:25.0.1'

Many thanks!
Abilio
 

rosippc64a

Active Member
Licensed User
Hi @abilio486software ,
after some years of your topic I have to solve the same problem.
Can you help me, what was the solution? I tried the connection via BLUETOOTH, but I got only a search device windows (long search, no result), when I tried via USB, there was no response.
After that I tried a purchase but no result, or a long error message.
thanks
Steven
 
Last edited:

abilio486software

Member
Licensed User
Hi,
You must be a myPOS registered developer to have access to the Java SDK, where you will find all the needed methods.

Abilio
 

rosippc64a

Active Member
Licensed User
Now I can print, but I have some trouble with payment. There is a payment activity, what should, but doesn't open window and there is no error message:
B4X:
    Private MEJo As JavaObject
    ...
    MEJo.InitializeContext
    ...
    MEJo.RunMethod("Kapcsolat", Array(MEJo))

#if JAVA

public void pyment() {
// Build the payment call
MyPOSPayment payment = MyPOSPayment.builder()
         // Mandatory parameters
         .productAmount(13.37)
         .currency(Currency.HUF)
         // Foreign transaction ID. Maximum length: 128 characters
         .foreignTransactionId(UUID.randomUUID().toString())
     // Optional parameters
     // Enable tipping mode
     .tippingModeEnabled(true)
         .tipAmount(1.55)
     // Operator code. Maximum length: 4 characters
     .operatorCode("1234")
     // Reference number. Maximum length: 20 alpha numeric characters
     .reference("asd123asd", ReferenceType.REFERENCE_NUMBER)
     // Set print receipt mode
     .printMerchantReceipt(MyPOSUtil.RECEIPT_ON)
     .printCustomerReceipt(MyPOSUtil.RECEIPT_ON)
         .build();

// If you want to initiate a moto transaction:
//payment.setMotoTransaction(true);

// Or you want to initiate a giftcard transaction:
//payment.setGiftCardTransaction(true);

// Start the transaction - doesn't start and no error.
//I could give the activity, I think is it ok
MyPOSAPI.openPaymentActivity(lA, payment, 1);
}
public void Kapcsolat(Activity activity) {
    lA = activity;
    BA.Log("openPaymentActivity");
    pyment();
    BA.Log("openPaymentActivity after");
}
#end if
Unfiltered log about very first run of "Kapcsolat" (here I can see a fast flickering):
openPaymentActivity
START u0 {act=com.mypos.transaction.START_TRANSACTION cmp=com.mypos/.ui.activity.PaymentActivity (has extras)} from uid 10090, pid 23252
###Enter launch scene bgn###
Enter common_subsys_set: enable:1, duration: 0, subsys:cpufreq: conf_2:5
Enter devfreq_ddr_set: enable:1, duration: 0, /sys/class/devfreq/scene-frequency/sprd_governor/scene_boost_dfs: max
notifySceneStatusChanged: notify 1 receivers
sceneId: 0 is invalid
###handle app Event: Exit
->startActivity for ActivityRecord{b2c2e7 u0 com.mypos/.ui.activity.PaymentActivity t113} result:START_SUCCESS
###Enter launch scene end###
openwindow után
windowsChanged
openPaymentActivity after
unfiltered log the second start of "Kapcsolat"
openPaymentActivity
START u0 {act=com.mypos.transaction.START_TRANSACTION cmp=com.mypos/.ui.activity.PaymentActivity (has extras)} from uid 10090, pid 23252
###Enter launch scene bgn###
Enter common_subsys_set: enable:1, duration: 0, subsys:cpufreq: conf_2:5
Enter devfreq_ddr_set: enable:1, duration: 0, /sys/class/devfreq/scene-frequency/sprd_governor/scene_boost_dfs: max
notifySceneStatusChanged: notify 1 receivers
sceneId: 0 is invalid
###handle app Event: Exit
->startActivity for ActivityRecord{b2c2e7 u0 com.mypos/.ui.activity.PaymentActivity t113} result:START_SUCCESS
###Enter launch scene end###
openwindow után
windowsChanged
openPaymentActivity after
@abilio486software was in your code some similar, or whether you experienced problem like this?
 
Last edited:
Top