Update Android native library loading based on deprecations
This commit is contained in:
parent
7ba248b535
commit
71977d816b
|
@ -2,7 +2,7 @@
|
||||||
* SerialPort.java
|
* SerialPort.java
|
||||||
*
|
*
|
||||||
* Created on: Feb 25, 2012
|
* Created on: Feb 25, 2012
|
||||||
* Last Updated on: Jan 25, 2022
|
* Last Updated on: Jan 27, 2022
|
||||||
* Author: Will Hedgecock
|
* Author: Will Hedgecock
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012-2022 Fazecast, Inc.
|
* Copyright (C) 2012-2022 Fazecast, Inc.
|
||||||
|
@ -85,12 +85,17 @@ public final class SerialPort
|
||||||
String line;
|
String line;
|
||||||
while ((line = buildProperties.readLine()) != null)
|
while ((line = buildProperties.readLine()) != null)
|
||||||
{
|
{
|
||||||
if((line.contains("[ro.product.cpu.abi]:") || line.contains("[ro.product.cpu.abi2]:") || line.contains("[ro.product.cpu.abilist]:") ||
|
if (line.contains("[ro.product.cpu.abi]:"))
|
||||||
line.contains("[ro.product.cpu.abilist64]:") || line.contains("[ro.product.cpu.abilist32]:")))
|
|
||||||
{
|
|
||||||
libraryPath = "Android/" + line.split(":")[1].trim().replace("[", "").replace("]", "").split(",")[0];
|
libraryPath = "Android/" + line.split(":")[1].trim().replace("[", "").replace("]", "").split(",")[0];
|
||||||
break;
|
else if (line.contains("[ro.product.cpu.abi2]:"))
|
||||||
|
backupLibraryPath = "Android/" + line.split(":")[1].trim().replace("[", "").replace("]", "").split(",")[0];
|
||||||
|
else if (line.contains("[ro.product.cpu.abilist]:"))
|
||||||
|
{
|
||||||
|
String[] abiList = line.split(":")[1].trim().replace("[", "").replace("]", "").split(",");
|
||||||
|
if (abiList.length > 0)
|
||||||
|
libraryPath = "Android/" + abiList[0];
|
||||||
|
if (abiList.length > 1)
|
||||||
|
backupLibraryPath = "Android/" + abiList[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getpropProcess.waitFor();
|
getpropProcess.waitFor();
|
||||||
|
@ -100,7 +105,9 @@ public final class SerialPort
|
||||||
catch (Exception e) { e.printStackTrace(); }
|
catch (Exception e) { e.printStackTrace(); }
|
||||||
|
|
||||||
if (libraryPath.isEmpty())
|
if (libraryPath.isEmpty())
|
||||||
libraryPath = "Android/armeabi";
|
libraryPath = "Android/armeabi-v7a";
|
||||||
|
if (backupLibraryPath.isEmpty())
|
||||||
|
backupLibraryPath = "Android/armeabi-v7a";
|
||||||
isAndroid = true;
|
isAndroid = true;
|
||||||
fileName = "libjSerialComm.so";
|
fileName = "libjSerialComm.so";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue