I am straggling with same problem in two apps.
I was trying to install to xiaomi phones with bridge. Xiaomi phones uses avast security and they are popular phones here in Greece.
The steps:
1. I made a new project and included all libraries i am using in my project. Compiled with mine key in release (obfuscated)
and a few more libraries.
Installed with bridge
without problem
2. Then in project -> build options i set KVS_ENCRYPTION
Installed with bridge
without problems
3. I copy all manifest from my main project to new and includes
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>)
AddManifestText(<uses-feature android:name="android.hardware.telephony" android:required="false"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:usesCleartextTraffic, "true")
AddPermission(android.permission.CAMERA)
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, Themes.LightTheme)
CreateResource(values, colors.xml,
<resources>
<color name="actionbar">#FF53588F</color>
<color name="statusbar">#FF3490dc</color>
<color name="textColorPrimary">#ff1c1d21</color>
<color name="navigationBar">#FF3490dc</color>
</resources>
)
'FF53588F FFC7DFF4
CreateResource(values-v20, theme.xml,
<resources>
<style name="LightTheme" parent="@android:style/Theme.Material.Light">
<item name="android:colorPrimary">@color/actionbar</item>
<item name="android:colorPrimaryDark">@color/statusbar</item>
<item name="android:itemBackground">@color/statusbar</item>
<item name="android:textColorPrimary">@color/textColorPrimary</item>
<item name="android:navigationBarColor">@color/navigationBar</item>
<item name="android:forceDarkAllowed">false</item>
<item name="android:colorAccent">@color/navigationBar</item>
<item name="android:alertDialogTheme">@style/AlertDialogCustom</item>
</style>
<style name="AlertDialogCustom" parent="@android:style/Theme.Material.Light.Dialog.Alert">
<item name="android:colorPrimary">#ff3490dc</item>
<item name="android:colorAccent">@color/navigationBar</item>
</style>
</resources>
)
CreateResource(values-v14, theme.xml,
<resources>
<style name="LightTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">@style/CustomActionBarStyle</item>
</style>
<style name="CustomActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">@color/actionbar</item>
</style>
</resources>
)
#AdditionalJar: com.google.android.gms

lay-services-vision
#AdditionalJar: com.android.support:support-v4
#AdditionalJar: com.google.android.gms

lay-services-base
now the phone shows something about
trojan
and in Virustotal the same.
4. changed min api to 21
Problem continues
5. Fresh install android SDK and OpenJDK 14 + OpenJFX 14.
Problem continues
6. SDK Manager and did all recomended updates
Problem continues
7. Updating com.android.support:support-v4
Problem continues
7. Now is the turn of
com.google.android.gms
lay-services-base to update
Same problem
8. FInal desperate try
Removed a lib of mine that finds gsfid of phone. I need it in order to have a unique number of device.
No problem!!!!
Install again lib
No problem again !!!!
Now i am totaly confused...
Now i found something. I was using
easyDeviceInfo and something of this code do the problem. Anyway, i removed any unnesessary code and i'm using only the java code i need.
Problem solved.
#If Java
//import android.Manifest;
//import android.accounts.Account;
//import android.accounts.AccountManager;
import android.annotation.TargetApi;
//import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.database.Cursor;
//import android.location.Location;
//import android.location.LocationManager;
//import android.media.AudioManager;
//import android.net.ConnectivityManager;
//import android.net.NetworkInfo;
import android.net.Uri;
//import android.net.wifi.WifiManager;
//import android.os.BatteryManager;
import android.os.Build;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
//import android.util.Log;
import android.view.Display;
//import android.view.MotionEvent;
import android.view.WindowManager;
//import android.webkit.WebView;
//import com.google.android.gms.ads.identifier.AdvertisingIdClient;
//import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
//import com.google.android.gms.common.GooglePlayServicesRepairableException;
//import java.io.File;
//import java.io.IOException;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.Collections;
import java.util.List;
//import java.util.Locale;
//import java.util.UUID;
private TelephonyManager tm; // = (TelephonyManager) BA.applicationContext.getSystemService(Context.TELEPHONY_SERVICE);
private String initialVal = "";
/**
* Instantiates a new Easy device info.
*
* @param context the context
*/
// public EasyDeviceInfo(Context context) {
// this.context = context;
// tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
// initialVal = "na";
// }
/**
* Gets library version.
*
* @return the library version
*/
// public String getLibraryVersion() {
// String version = "1.1.9";
// int versionCode = 11;
// return version + "-" + versionCode;
// }
/**
* Gets android id.
*
* @return the android id
*/
public String getAndroidID() {
String result = initialVal;
try {
result = Settings.Secure.getString(BA.applicationContext.getContentResolver(), Settings.Secure.ANDROID_ID);
} catch (Exception e) {
e.printStackTrace();
}
if (result == null || result.length() == 0) {
result = initialVal;
}
return result;
}
/**
* Gets model.
*
* @return the model
*/
public String getModel() {
String result = initialVal;
try {
result = Build.MODEL;
} catch (Exception e) {
e.printStackTrace();
}
if (result == null || result.length() == 0) {
result = initialVal;
}
return handleIllegalCharacterInResult(result);
}
/**
* Gets build brand.
*
* @return the build brand
*/
public String getBuildBrand() {
String result = initialVal;
try {
result = Build.BRAND;
} catch (Exception e) {
e.printStackTrace();
}
if (result == null || result.length() == 0) {
result = initialVal;
}
return handleIllegalCharacterInResult(result);
}
/**
* Gets gsfid.
*
* @return the gsfid
*/
public String getGSFID() {
final Uri URI = Uri.parse("content://com.google.android.gsf.gservices");
final String ID_KEY = "android_id";
String[] params = { ID_KEY };
Cursor c = BA.applicationContext.getContentResolver().query(URI, null, null, params, null);
if (c == null) {
return initialVal;
} else if (!c.moveToFirst() || c.getColumnCount() < 2) {
c.close();
return initialVal;
}
try {
String gsfID = Long.toHexString(Long.parseLong(c.getString(1)));
c.close();
return gsfID;
} catch (NumberFormatException e) {
c.close();
return initialVal;
}
}
/**
* Gets ip address.
*
* @param useIPv4 the use i pv 4
* @return the ip address
*/
public String getIPAddress(boolean useIPv4) {
String result = initialVal;
try {
List<NetworkInterface> interfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
for (NetworkInterface intf : interfaces) {
List<InetAddress> addrs = Collections.list(intf.getInetAddresses());
for (InetAddress addr : addrs) {
if (!addr.isLoopbackAddress()) {
String sAddr = addr.getHostAddress().toUpperCase();
boolean isIPv4 = addr instanceof Inet4Address;
if (useIPv4) {
if (isIPv4) result = sAddr;
} else {
if (!isIPv4) {
int delim = sAddr.indexOf('%'); // drop ip6 port suffix
result = delim < 0 ? sAddr : sAddr.substring(0, delim);
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
if (result == null || result.length() == 0) {
result = initialVal;
}
return result;
}
private String handleIllegalCharacterInResult(String result) {
if (result.indexOf(" ") > 0) {
result = result.replaceAll(" ", "_");
}
return result;
}
/**
* Gets resolution.
*
* @return the resolution
*/
public String getResolution() {
String result = initialVal;
try {
WindowManager wm = (WindowManager) BA.applicationContext.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
result = metrics.heightPixels + "x" + metrics.widthPixels;
} catch (Exception e) {
e.printStackTrace();
}
if (result.length() == 0) {
result = initialVal;
}
return result;
}
/**
* Gets device.
*
* @return the device
*/
public String getDevice() {
String result = initialVal;
try {
result = Build.DEVICE;
} catch (Exception e) {
e.printStackTrace();
}
if (result == null || result.length() == 0) {
result = initialVal;
}
return result;
}
#End If