Dependency app does not run - android

After I added the android-3.2 dependency, it did not run in my smartphone and gave me this error:
Error:Execution failed for task ':app:transformClassesWithInstantRunForDebug'.
Unexpected constructor structure.
here is the image of adding dependency
Whenever I don't add the dependency, the app runs in my smartphone.
BTW, I don't use any emulator for testing my app, I just run directly in my smartphone.
please help me.

Related

NoClassDefFoundError when running unit test with Gradle task

I have a project using dynamic feature module, and I want to run my unit test in feature module via gradle task (for my CI purpose):
./gradlew :feature_product:test
But it always gives me NoClassDefFoundError for tests that have dependencies on classes from the base module:
com.example.android.feature.product.ProductViewTest > on vote change to negative FAILED
java.lang.NoClassDefFoundError: app.BaseView
ProductView class from the feature module extends BaseView from the base module.
Oddly, it succeeds when run in Android Studio, it works fine.
Then I notice something different in the logs, when I run via command line and when I run Android Studio. The first line in the Android Studio is generateDebugSources, something which absent when I run ./gradlew test
Executing tasks: [:lib_ui:generateDebugSources, ...]
How do I fix this? Does Android Studio has different command with the provided command ./gradlew test when I press Ctrl+Shift+R ?
After searching further about this issue, I found it also being reported in the android-test and app-bundle-samples projects and there is also an issue in the issue tracker.
It turns out this issue fixed in the Android Gradle Plugin 4.1.0 as per comment in the issue tracker.
If you don't want to update AGP to 4.1.0 which is still in alpha, adding this to the feature module's build.gradle fixed the issue for me, as per this comment:
testRuntimeOnly(files("$projectDir/../b_app/build/intermediates/app_classes/debug/classes.jar"))
If it is a missing task that you believe is necessary then calling it first like below should do the trick:
./gradlew :lib_ui:generateDebugSources :feature_product:test
I would even go full on and assemble the dependencies if necessary though that might take more time:
./gradlew :lib_ui:assemble :feature_product:assemble :feature_product:test

Cannot run React Native Project on Android Device or Simulator with React-Native-Maps dependency

I am currently trying to build and run my project on android but it keeps failing. I followed all the instructions for setting up the android environment correctly, as I am able to get my other applications to work on the simulator. I am using the React native maps dependency on this project, and for some reason whenever I run react-native run-android it crashes with this error:
error: constructor ActionSheetPackage in class ActionSheetPackage cannot be applied to given types;
new ActionSheetPackage()
^
required: FragmentActivity
found: no arguments
reason: actual and formal argument lists differ in length
1 error
:app:compileDebugJavaWithJavac FAILED
Followed by:
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
I've tried troubleshooting using what can be found on the react-native-maps github page, and none of that seems to work. Does anyone have any ideas?
It turns out that the issue was that there was a dependency that did not work on android. When I npm installed the dependency it also installed it's self in the android portion of the project. Once I removed it from there it worked like a charm.

Unable to Build the project after gradle :2.1.0

I was trying to implement google gcm in my app.For that, I require google play services to be added.All setup has made as required.But while building getting error like this:
Error:Execution failed for task ':app:clean'.
Unable to delete directory: /media/Development/Projects/Source/MyApp/app/build/intermediates/exploded-aar/AARPNow/oplytic_sdk-1.0/unspecified/jars
If I remove that oplytic_sdk-1.0 library and then same error will pointing to other dependencies.
Does anybody know whats wrong with my gradle?

"Could not initialize class" error running lint target from gradle

I'm working on an Android project with two projects inside it. When trying to run a build with gradlew (./gradlew build), I see the following error:
Execution failed for task ':example:lint'.
Could not initialize class
com.android.build.gradle.tasks.Lint$LintGradleIssueRegistry
With stacktrace enabled, this is listed as a java.lang.NoClassDefFoundError.
Oddly, the first time I ran this (which downloaded dependencies), the build failed with a different error:
Execution failed for task ':example:lint'.
lombok/ast/Node
The gradle wrapper that Android SDK created for the project is using Gradle 2.8.
Could this be a configuration issue with the project or my dev machine? I'm trying to avoid using the Android SDK lint tool as this complains about the projects using Gradle (and I hear it may miss some parts of these projects).
Turned out this was a configuration issue in our build.gradle. The following line had been added for testing and never removed:
configurations.classpath.exclude group: 'com.android.tools.external.lombok'
As such, the classes needed for linting were missing.
The following discussion pointed us in the right direction, in case it's useful to anyone else:
https://github.com/evant/gradle-retrolambda/issues/96

Setting up AndEngine

I added AndEngine as a module dependency but when I try to run my project I am faced with the following error :
Gradle: Execution failed for task ':Game:compileDebug'.
Compilation failed; see the compiler error output for details.
And
Gradle: error: package org.andengine.engine.camera does not exist
Has anyone been able to successfully get their AndEngine running on Android Studio? I would greatly appreciate it if you could tell me the steps I need to take to get it running.
What I ended up doing was creating the project in eclipse and setting up andengine for the project, then importing that same project in android studio, set up the required dependencies then I been using it since no hassle.

Categories

Resources