How to make app compatible with Android 12 (Snow Cone) - ionic5

I am trying to build my Ionic App to support Android 12. It works fine upto Android 11, but is not supporting Android 12.
==Supported credentials to Android 11==
package.json
“cordova-android”: “^9.1.0”
build.gradle file:
defaultBuildToolsVersion=“29.0.2”
defaultMinSdkVersion=22
defaultTargetSdkVersion=30
defaultCompileSdkVersion=30
config.xml file:
preference name="android-targetSdkVersion" value="30"
==Tried increasing sdk to 31==
package.json file:
“cordova-android”: “^10.0.0”
build.gradle file:
defaultTargetSdkVersion=31
defaultCompileSdkVersion=31
config.xml file:
preference name="android-targetSdkVersion" value="31"
added android:exported=“true” in MainActivity in ..\platforms\android\app\src\main\AndroidManifest.xml
Error :
FCMPlugin: Support for Gradle v4 or lower is deprecated. Please upgrade to a newer version.WARNING:: Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ and ‘api’.
It will be removed in version 7.0 of the Android Gradle plugin.
For more information, see Add build dependencies | Android Developers.
WARNING:: Using flatDir should be avoided because it doesn’t support any meta-data formats.
Task :app:processDebugMainManifest FAILED
…\platforms\android\app\src\main\AndroidManifest.xml Error:
Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See <activity> | Android Developers for details.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ‘:app:processDebugMainManifest’.
Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See <activity> | Android Developers for details.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use ‘–warning-mode all’ to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See Command-Line Interface
BUILD FAILED in 3s
15 actionable tasks: 1 executed, 14 up-to-date
Command failed with exit code 1: …\platforms\android\gradlew cdvBuildDebug -b …\platforms\android\build.gradle
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
I have tried all forums and posts, nothing seem to works. Anybody has an idea on how to make this work?

Related

Build fails when using file picker but when I use file_picker version less then 2.0.0 it works

FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
D:\Working\flutter projects\todo_app\android\projects\todo_app\build\file_picker\intermediates\library_manifest\debug\AndroidManifest.xml:9:5-15:15: AAPT: error: unexpected element found in .
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 28s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin file_picker...
Checking the license for package SDK Patch Applier v4 in C:\Program Files\Android\Android Studio\licenses
Warning: License for package SDK Patch Applier v4 not accepted.
Checking the license for package Android Emulator in C:\Program Files\Android\Android Studio\licenses
Warning: License for package Android Emulator not accepted.
Checking the license for package Android SDK Platform-Tools in C:\Program Files\Android\Android Studio\licenses
Warning: License for package Android SDK Platform-Tools not accepted.

How to fix build gradle asemble release failed in react native 0.59

I want to generate my project react native but i have some problems
Its in sdk version of my Android
>
> Configure project :react-native-vector-icons
WARNING: The specified Android SDK Build Tools version (28.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.3.1.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '28.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
> Task :app:bundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Failed to capture fingerprint of input files for task ':app:bundleReleaseJsAndAssets' property '$1' during up-to-date check.
> Could not list contents of '/Users/halojasa/halojasa_com/node_modules/node-pre-gyp/node_modules/.bin/detect-libc'. Couldn't follow symbolic link.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2s
85 actionable tasks: 1 executed, 84 up-to-date
Now I can't release my App, please somebody help me . . . .
Add these lines to android/build.gradle above allprojects code
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 28
buildToolsVersion "28.0.2"
}
}
}
}
allprojects {
...all project stuff...
}

Strange build failure when deploying GAE using gradle

Everything used to work fine until today. Didn't change anything as far as I know and now I get this:
C:\mypath>gradle appengineDeploy
> Configure project :
WARNING: You are a using release candidate 2.0.0-rc1. Behavior of this plugin has changed since 1.3.5. Please see release notes at: https://github.com/GoogleCloudPlatform/app-gradle-plugin.
Missing a feature? Can't get it to work?, please file a bug at: https://github.com/GoogleCloudPlatform/app-gradle-plugin/issues.
> Task :appengineDeploy FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':appengineDeploy'.
> Deployment version must be defined or configured to read from system state
1. Set appengine.deploy.version = 'my-version'
2. Set appengine.deploy.version = 'GCLOUD_CONFIG' to have gcloud generate a version for you.
3. Using APPENGINE_CONFIG is not allowed for flexible environment projects
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.8.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 6s
8 actionable tasks: 6 executed, 2 up-to-date
I just updated gradle from version 4.5.1 to 4.8.1 but the same issue remains. I understand it complains about version of the appengine but I never had to state that before so I think it's due to some update on Google's side. What am I missing?
You are now using the app-gradle-plugin version 2.0.0-rc1 as I can see from your console output, which was released 2 days ago. It has some changes, which the developers of the plugin documented.
As you can see in the Change Log of this release candidate from google, it mentions in the changes:
project and version are no longer pulled from the global gcloud state by default. project must be configured in build.gradle using the deploy.project property, users may use special keywords for project to specify that they would like to read it from appengine-web.xml (project = "APPENGINE_CONFIG") or from gcloud global state (project = "GCLOUD_CONFIG"). version is also configured the same way.
So you just have to specify in your gradle.build the following:
appengine {
deploy {
version = "GCLOUD_CONFIG"
project = "GCLOUD_CONFIG"
}
}
Update in 2.0.0-rc3 (Thanks to #wildcat12 for pointing it out)
in the latest version 2.0.0-rc3, the project configuration property has changed.
Changed appengine.deploy.project -> appengine.deploy.projectId
Therefore, now your gradle.build configuration would look like that:
appengine {
deploy {
version = "GCLOUD_CONFIG"
projectId = "GCLOUD_CONFIG"
}
}
If you are using
classpath 'com.google.cloud.tools:appengine-gradle-plugin:+'
line in your build.gradle file you are using the 2.0.0-rc3 release candidate version now. It is working well with last stable version: 1.3.5.

Unable to run the first time react-native app for android on mac

I'm trying to run the react-native application on the macbook for android version.So I have followed all the step for setting up the environment on the machine from here :
https://facebook.github.io/react-native/docs/getting-started.html
And I have successfully install Android Studio,Android SDK, JDK, Node, NPM, Watchman, Homebrew
javac -version : 9
node -v : v8.9.1
npm -v: 5.5.1
watchman version: 4.9.0
When I tried to run the application with the command
react-native run-android
I got this error :
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.gradle.internal.reflect.JavaMethod (file:/Users/aman/.gradle/wrapper/dists/gradle-2.14.1-all/8bnwg5hd3w55iofp58khbp6yv/gradle-2.14.1/lib/gradle-base-services-2.14.1.jar) to method java.lang.ClassLoader.getPackages()
WARNING: Please consider reporting this to the maintainers of org.gradle.internal.reflect.JavaMethod
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> javax/xml/bind/annotation/XmlSchema
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 9.925 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
According to this GitHub issue, this issue has to do with JDK version. Make sure you're using v8, not v9, then the error should not occur.
Yes, according to #Sam Hanley it's an issue with the java version update. So, with worrying about the version update/downgrade, we can pass on with this issue by the following process;
First, update the distributionUrl in gradle-wrapper.properties
ie: located in this path;
PROJECT_PATH/android/gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-rc-2-all.zip
Set $JAVA_HOME environment variable using the installed android studio app path (Android studio should be installed)
export JAVA_HOME="/Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home"
(PS: solution for macOS )
Hope this help!
I was able to get past this particular problem by doing the following:
Edit path_to_your_project/android/gradlew
Change DEFAULT_JVM_OPTS="" to DEFAULT_JVM_OPTS="--add-modules java.se.ee"

m2eclipse - Mystery Build Failure on Package

I am using Eclipse 3.6 (Helios64) and m2eclipse 0.12.1.20110112-1712. I have a new project that only contains two classes that builds a jar. When I right click the project and select "Run As -> Maven package", I get the following error:
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # switch-provisioning-rest-client --- [INFO] Compiling 2 source files to C:\Devel\EclipseProjects\MyProject\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Failure executing javac, but could not parse the error:
javac: invalid flag: -s
...
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
When I set up a run configuration with the Goals "package -X", the project builds without error. If I run a configuration with the goal set to compile, it builds without error and I can then run "Maven package" successfully.
This is the only project I'm having issues with. All my other projects build sucessfully when doing a "Maven package".
There's nothing exceptional about the project pom.xml. It refers to the same parent pom as the other projects and contains its project specific dependencies.
Has anybody got any ideas what could be different about this project?
TIA!
This issue was answered on the m2eclipse mailing list:
http://dev.eclipse.org/mhonarc/lists/m2e-users/msg01818.html
Although my pom had 1.6 as the version, the project configuration hadn't been updated.
From: Benjamin Bentmann
This issue is not really specific to m2e but applies to mvn in general, as such the Maven user list might provide a better audience for help.
IIRC, the specific error means you trying to use a JDK 1.5 while you need JDK 1.6+ where the javac option in question was added. Assuming your project should actually compile against JDK 1.5, downgrading the maven-compiler-plugin version might also do, I would expect it started to use the -s option when the annotation processing support was added.

Resources