IntelliJ IDEA won't run Flutter app - intellij-idea

I am experiencing a strange issue with Flutter development and IntelliJ IDEA. I am developing a flutter application with IntelliJ IDEA 2017 1.4 Build number IC-171.4694.23, I am not able to run application on connected Android device, when I run the application, it shows a background process running "Running gradle assembleDebug... " and then the process stops, nothing happens although I was able to run and debug it earlier.
Solution tried,
Disabling/ enabling adb plugin.
Disabling/ enabling developer options and usb debugging.
Re-installing flutter.
I tried with android emulator also, same thing happens. So I think the problem is not with the device. Any help is appreciated.
Update:
This issue happens when I add image_picker plugin to my pubspec.yaml.
dependencies:
flutter:
sdk: flutter
image_picker:

Is flutter run failing with the following error?
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
> Could not find com.github.esafirm.android-image-picker:imagepicker:1.5.0.
Required by:
project :app > project :image_picker
> Could not get unknown property 'compileDebugJavaWithJavac' for project ':app' of type org.gradle.api.Project.
If so, you can fix this issue by modifying your build.gradle as described in the image_picker documentation.
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" } // add this line
}
}

Related

i having issues with eas build. always stuck on run gradle

Android build failed:
Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.
**any solution? **
the same as in this forum but I also haven't found the answer
https://github.com/expo/eas-cli/issues/1496
WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the gradle.properties file or use the new publishing DSL.
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.
try
expo doctor
expo doctor --fix-dependencies
but not fixed

Error when trying to build a React Native application with EAS

I'm trying to build a React Native application using Expo and rnmapbox/maps module, which includes some custom native code.
Up until now, I could build the application without any problems, for Android at least, which is my target platform. But suddenly, it stopped working and the following error log is displayed:
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin class 'org.gradle.api.plugins.BasePlugin'.
> Could not find method maven() for arguments [build_1quotit9ccucu377qnhf7kv5h$_run_closure1$_closure3$_closure5#4a87f9f7] on configuration ':app:archives' of type org.gradle.api.in
ternal.artifacts.configurations.DefaultConfiguration.
What is the problem and how can I possibly fix it?
The problem appears to be with Mapbox. We are experiencing the same error as you on our Android builds under eas build. We just removed the rnmapbox/maps dependency and commented out all the relevant code and our builds are passing.
I added the "image": "latest" field to eas.json configuration and it seemed to fix the problem.
Apparently, there was a bug with older versions.

react-native - Upgrading to Gradle 7 breaks project

react-native: 0.66.4
Upgraded:
Gradle Plugin from 4.2.2 to 7.0.2
Gradle from 6.9.0 to 7.2.0
When running react-native run-android got:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file '/Users/chen.oppenhaim/dev/toluna-mobile-app/mobile-apps/node_modules/react-native-rate/android/build.gradle' line: 41
* What went wrong:
A problem occurred evaluating project ':react-native-rate'.
> Plugin with id 'maven' not found.
Its seems that now one of my react-native packages (react-native-rate) is not compatible with Gradle 7.
I guess that once I fixed this issue - other packages as well will have incompatibilities issues as well.
How should I approach this issue?
android/build.gradle (Gradle plugin version):
buildscript {
dependencies {
classpath('com.android.tools.build:gradle:7.0.2')
}
}
gradle-wrapper.properties (Gradle version):
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
Finally solved it.
Those Gradle plugin and Gradle upgrades are possible in react-native project but keep in mind that other react-native packages in your project might not be compatible with Gradle 7.
Specific for the error I got - upgrading react-native-rate to latest version solve the issue - but it was not the only upgrade I needed to do - so you can expect that (overall 4 upgrades).
Also not sure What I gain from this Gradle upgrade but this is another discussion.

react-native android app quits before it launches (0.61.2) - couldn't find DSO to load: libhermes.so - Channel is unrecoverably broken

I have been trying to migrate from react-native 0.59.4 to 0.61.2.
After solving many many build and runtime problems on ios and android, this was the final problem before the successful launch of my react-native app on android. The app would build successfully but when it is time to launch on the emulator it would pop for a very brief moment then a white screen and application crashed with an app keeps crashing type of popup message. I can't even debug the app remotely on the chrome console since it doesn't launch in the first place.
Any ideas?
Note: This solution worked for my specific problem. To find out your problem try adb logcat *:E to see what is wrong in your case.
Ok, there is a very important command (I am on mac) that helps you see in the logs what is going on even if you can't launch the app on emulator: adb logcat *:E
In my case there were 2 main problems that caught my attention in the logs.
Channel is unrecoverably broken and will be disposed
and
couldn't find DSO to load: libhermes.so
Once I got these messages on my radar I started to dig/google for them.
After going through a lot of SO and GitHub topics here is what worked for me:
First, make sure you have made all the necessary modifications in your:
gradle.properties
app/build.gradle
android/build.gradle
package.json
etc
files (Use react-native upgrade helper to do this).
Then, if it is not installed already, do npm install jsc-android to install the required jsc package on your project.
Add the below in android/build.graddle inside allprojects -> repositories
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
Inside gradle.properties add
android.useAndroidX=true
android.enableJetifier=true
In some cases you may need to add below line to package.json
"postinstall": "npx jetify"
Also, in some cases it may help to replace the below line (dependencies section of app/build.gradle) with the exact version of the react-native you are using:
implementation "com.facebook.react:react-native:+"
Replace like so:
implementation "com.facebook.react:react-native:**0.61.2**"
I hope this helps to solve or at least make some progress with your problem.
Cheers.

Run realm with android experimental plugin

Is there a way to use Realm with the latest Android experimental plugin for Gradle:
http://tools.android.com/tech-docs/new-build-system/gradle-experimental ?
Here is an error message, which I've got during application build:
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'realm-android']
> 'com.android.application' or 'com.android.library' plugin required.
I'm interested in Realm, but I need to use experimental plugin because of its NDK support the same time.
Update Android Studio to 2.2 resolved the problem.
"There are other choices now like the the ndk with cmake which doesn't require the experimental plugin https://github.com/googlesamples/android-ndk/tree/master-cmake/hello-jni ."
found here