merge master

This commit is contained in:
jcesarmobile 2023-04-15 00:20:24 +02:00
commit d308a9a9b5
5 changed files with 14 additions and 27 deletions

View File

@ -2,10 +2,10 @@
"MIN_SDK_VERSION": 24, "MIN_SDK_VERSION": 24,
"SDK_VERSION": 33, "SDK_VERSION": 33,
"COMPILE_SDK_VERSION": null, "COMPILE_SDK_VERSION": null,
"GRADLE_VERSION": "8.0", "GRADLE_VERSION": "8.0.2",
"MIN_BUILD_TOOLS_VERSION": "33.0.2", "MIN_BUILD_TOOLS_VERSION": "33.0.2",
"AGP_VERSION": "8.0.0", "AGP_VERSION": "8.0.0",
"KOTLIN_VERSION": "1.5.21", "KOTLIN_VERSION": "1.7.21",
"ANDROIDX_APP_COMPAT_VERSION": "1.6.1", "ANDROIDX_APP_COMPAT_VERSION": "1.6.1",
"ANDROIDX_WEBKIT_VERSION": "1.6.0", "ANDROIDX_WEBKIT_VERSION": "1.6.0",
"ANDROIDX_CORE_SPLASHSCREEN_VERSION": "1.0.0", "ANDROIDX_CORE_SPLASHSCREEN_VERSION": "1.0.0",

View File

@ -51,7 +51,8 @@ public class BuildHelper {
{ {
try try
{ {
Class<?> clazz = Class.forName(ctx.getClass().getPackage().getName() + ".BuildConfig"); String packageName = ctx.getApplicationInfo().packageName;
Class<?> clazz = Class.forName(packageName + ".BuildConfig");
Field field = clazz.getField(key); Field field = clazz.getField(key);
return field.get(null); return field.get(null);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {

View File

@ -19,6 +19,8 @@
package org.apache.cordova; package org.apache.cordova;
import org.apache.cordova.BuildHelper;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -30,7 +32,6 @@ import android.content.IntentFilter;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.view.KeyEvent; import android.view.KeyEvent;
import java.lang.reflect.Field;
import java.util.HashMap; import java.util.HashMap;
/** /**
@ -376,35 +377,19 @@ public class CoreAndroid extends CordovaPlugin {
} }
} }
/* /*
* This needs to be implemented if you wish to use the Camera Plugin or other plugins * This needs to be implemented if you wish to use the Camera Plugin or other plugins
* that read the Build Configuration. * that read the Build Configuration.
* *
* Thanks to Phil@Medtronic and Graham Borland for finding the answer and posting it to * Thanks to Phil@Medtronic and Graham Borland for finding the answer and posting it to
* StackOverflow. This is annoying as hell! * StackOverflow. This is annoying as hell!
* *
* @deprecated Use {@link BuildHelper#getBuildConfigValue} instead.
*/ */
@Deprecated
public static Object getBuildConfigValue(Context ctx, String key) public static Object getBuildConfigValue(Context ctx, String key)
{ {
try LOG.w(TAG, "CoreAndroid.getBuildConfigValue is deprecated and will be removed in a future release. Use BuildHelper.getBuildConfigValue instead.");
{ return BuildHelper.getBuildConfigValue(ctx, key);
Class<?> clazz = Class.forName(ctx.getClass().getPackage().getName() + ".BuildConfig");
Field field = clazz.getField(key);
return field.get(null);
} catch (ClassNotFoundException e) {
LOG.d(TAG, "Unable to get the BuildConfig, is this built with ANT?");
e.printStackTrace();
} catch (NoSuchFieldException e) {
LOG.d(TAG, key + " is not a valid field. Check your build.gradle");
} catch (IllegalAccessException e) {
LOG.d(TAG, "Illegal Access Exception: Let's print a stack trace.");
e.printStackTrace();
} catch (NullPointerException e) {
LOG.d(TAG, "Null Pointer Exception: Let's print a stack trace.");
e.printStackTrace();
}
return null;
} }
} }

View File

@ -24,6 +24,8 @@ android {
compileSdkVersion cordovaConfig.COMPILE_SDK_VERSION compileSdkVersion cordovaConfig.COMPILE_SDK_VERSION
buildToolsVersion cordovaConfig.BUILD_TOOLS_VERSION buildToolsVersion cordovaConfig.BUILD_TOOLS_VERSION
namespace 'org.apache.cordova.unittests'
defaultConfig { defaultConfig {
applicationId "org.apache.cordova.unittests" applicationId "org.apache.cordova.unittests"
minSdkVersion cordovaConfig.MIN_SDK_VERSION minSdkVersion cordovaConfig.MIN_SDK_VERSION

View File

@ -17,8 +17,7 @@
specific language governing permissions and limitations specific language governing permissions and limitations
under the License. under the License.
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android">
package="org.apache.cordova.unittests">
<application <application
android:allowBackup="true" android:allowBackup="true"