I was trying to revive an old B4A project using B4A V13.0
While compiling the B4A project it called for:
So, started SDKManager from within the B4A project, searched for the dependencies, and installed them.
But it does not install them in the correct folder. It installed it in folder.....
...while it should have been installed in folder....
I copied the installation folders (installed via SDKManager) from the "wrong" folder to the "correct" folder, then manually updated....
...and the project then compiled successfully.
This is the B4A code after I copied the dependencies to the correct folder and updated the txt file :
Question why are the dependencies installed to the incorrect folder? Does it have something to do with my configuration paths? The config paths seem to be correct as all other project are working.
While compiling the B4A project it called for:
B4X:
androidx.resourceinspection:resourceinspection-annotation
androidx.transition:transition-ktx
So, started SDKManager from within the B4A project, searched for the dependencies, and installed them.
But it does not install them in the correct folder. It installed it in folder.....
Wrong Folder:
C:\Android\commandlinetools-win-9123335_latest\extras\b4a_remote\androidx
...while it should have been installed in folder....
B4X:
C:\Android\extras\b4a_remote\androidx
I copied the installation folders (installed via SDKManager) from the "wrong" folder to the "correct" folder, then manually updated....
B4X:
installed-components.txt
...and the project then compiled successfully.
This is the B4A code after I copied the dependencies to the correct folder and updated the txt file :
B4X:
#Region Project Attributes
#ApplicationLabel: AndroidVisionFaceTracker
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#End Region
#AdditionalRes: ..\resource
#AdditionalJar: com.google.android.gms:play-services-code-scanner
#AdditionalJar: kotlin-stdlib-1.6.10
#AdditionalJar: androidx.arch.core:core-runtime
#AdditionalJar: androidx.resourceinspection:resourceinspection-annotation
#AdditionalJar: androidx.transition:transition-ktx
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim nativeMe As JavaObject
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private Button1 As Button
Dim myscan As AndroidVisionFaceTracker
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("main")
nativeMe.InitializeContext
Log("ID of Front Facing Camera = " & nativeMe.RunMethod("getFrontFacingCamera", Null))
Log("ID of Back Facing Camera = " & nativeMe.RunMethod("getBackFacingCamera", Null))
Log("Device has a flash = " & nativeMe.RunMethod("hasFlash", Null))
myscan.Initialize("scanner")
myscan.CameraToUse = 0 '0 = back camera, 1 = front camera
myscan.LeftEyeText = "Bothidae: "
myscan.RightEyeText = "Pleuronectidae: "
myscan.HappinessText = "Felicidade :"
myscan.BoxStrokeWidth = 7
myscan.IdTextSize = 30
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
myscan.beginScan
End Sub
Sub scanner_scan_result(faceid As Int, IsLeftEyeOpenProbability As Float, IsRightEyeOpenProbability As Float, IsSmilingProbability As Float)
Log("back in b4a with faceid = " & faceid)
Log("back in b4a with IsLeftEyeOpenProbability = " & IsLeftEyeOpenProbability)
Log("back in b4a with IsRightEyeOpenProbability = " & IsRightEyeOpenProbability)
Log("back in b4a with IsSmilingProbability = " & IsSmilingProbability)
Log(" ")
End Sub
#If Java
import android.hardware.Camera;
import android.hardware.Camera.Parameters;
import android.hardware.Camera.CameraInfo;
import android.content.pm.PackageManager;
import android.content.Context;
public int CAMERA_FRONT = -1;
public int CAMERA_BACK = -1;
private boolean hasflash = false;
public int getFrontFacingCamera() {
int cameraId = -1;
// Search for the front facing camera
// get the number of cameras
int numberOfCameras = Camera.getNumberOfCameras();
// for every camera check
for (int i = 0; i < numberOfCameras; i++) {
CameraInfo info = new CameraInfo();
Camera.getCameraInfo(i, info);
if (info.facing == CameraInfo.CAMERA_FACING_FRONT) {
cameraId = i;
break;
}
}
CAMERA_FRONT = cameraId;
return cameraId;
}
/**
* Get the ID of the back facing camera
* If the device has a front and back camera then the ID = 0
* If the device has a back facing camera only then the ID = 0
* It will return the ID as -1 if there is no back facing camera
*/
public int getBackFacingCamera() {
int cameraId = -1;
// Search for the back facing camera
// get the number of cameras
int numberOfCameras = Camera.getNumberOfCameras();
// for every camera check
for (int i = 0; i < numberOfCameras; i++) {
CameraInfo info = new CameraInfo();
Camera.getCameraInfo(i, info);
if (info.facing == CameraInfo.CAMERA_FACING_BACK) {
cameraId = i;
break;
}
}
CAMERA_BACK = cameraId;
return cameraId;
}
public boolean hasFlash() {
/*
* First check if device is supporting a flashlight or not
*/
hasflash = BA.applicationContext.getPackageManager()
.hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);
return hasflash;
}
#End If
Question why are the dependencies installed to the incorrect folder? Does it have something to do with my configuration paths? The config paths seem to be correct as all other project are working.
Last edited: