Why everytime open a new flutter project this error appear? - android-studio

I have tried a different kind of ways to resolve the error but still can't resolve, and I'm still a new learner on flutter. But I still can run the whole project well without resolving the error shown.

There is no error that's just ide warning I think, that could be about typo etc, If you click to lamp and show us the suggestions then we can help more.
But I tried this part of code and get different warning and solved it with add # to override such as;
class MainActivity: FlutterActivity(){
#override fun configureFlutterEngine(#NonNull flutterEngine: FlutterEngine){
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
}
If that's show same you need to check your ide settings, probably there is a missing plugin(Dart or Flutter).

Related

use Intent in Kotlin

When we want to move to another Activity using Intent in Kotlin, it gives this error.
In Intent, it doesn't recognize .java after ::class
look:
And when I delete .java, Intent gives an error
Note: My problem was not solved with Invalidate Caches / Restart... option in File
I don't know where the problem is. please help me.
Kinda strange because it seems good to me. Try this.
Remove the lateinit and declare it directly when you need it, maybe it will solve the problem.
val intent = Intent(this, LauncherActivity::class.java)
I don't think the this#KotlinActivity is needed in this case.
Let me know if this fix it
UPDATE
Are you sure the findViewById<TextView>... is correct ? Shouldn't it has a declaration before ? Like
val view = findViewById<>...
The solution is:
In build.gradle (:app) file, in dependencies, you should change appcompat version to 1.4.2.
befor error:
dependencies {
implementation 'androidx.appcompat:appcompat:1.5.0'
...
}
And when I changed the version to 1.4.2, the problem was solved
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.2'
...
}
And make sure the kotlin version is 1.5.0

Undefined steps after running test from TestRunner class

I have a very strange situation, I have created Features and Scenarios in the feature file and corresponding step definitions and methods in the separate class.
I have run tests by running a feature file, and everything was fine, all tests were green.
But, when I run tests from TestRunner class, I got the following message:
Undefined step: Given I am on the Facebook Login page and suggested code.
You can implement missing steps with the snippets below:
#Given("^I am on the Facebook Login page$")
public void i_am_on_the_Facebook_Login_page() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
I have noticed that the suggested method have underscore:
(i_am_on_the_Facebook_Login_page())
but my methods do not have underscore
(iAmOnTheFacebookLoginPage())
Does anybody have an idea why this happens? I can't run tests now even from the feature file.
Recently, I have started using Mac and IntelliJ instead of Windows and Eclipse.
Is it possible that IntelliJ causes the problem?
P.S. I have used the option "Create step definition" from IntelliJ
ah...I figured out what the problem was...I forgot to put this piece of code
snippets = SnippetType.CAMELCASE
in CucumberOptions.
So, when I put this line of code here
#CucumberOptions(
plugin = {"pretty"},
features = {"src/test/resources/features"}, glue = {"/java/stepDefinitions"}, snippets = SnippetType.CAMELCASE)
everything works just fine.
It is possible your features folder is not in the build path (being a test folder) so Cucumber is unable to find it. Try this.

using AutoData (from AutoFixture) with xUnit all my tests disappear

I've been trying to find something on this but can't see what the problem is. If I use the code below, with nothing added all my tests disappear. If I remove the AutoData attribute, they all come back. I've seen somewhere that it may have something to do with the dependency of AutoFixture on xunit.extensions (AutoFixture in F#) but the answer wasn't clear enough for me to be able to solve my problem. I'm using xunit in a C# MVC5 project.
I ran Add-BindingRedirect (as mentioned in that link) and in fact xunit.extensions were not in the app.config at all so I added it in, but it made no difference... so I'm not sure where to go from there. Any advice?
[Theory, AutoData]
public void AutoFixtureAutoData(int number1, int number2)
{
}

What is the meaning of 'cannot resolve symbol R' error in android studio?

When I try to compile my project it says cannot resolve symbol R. why do I get that error? If it's because an xml file is corrupted what is the solution to the above issue?
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.advanced_quiz);
}
This happens all the time to me as well. Especially when going between versions or basically changing anything with Android Studio.
Without more information, I can't give you a definite answer, but typically cleaning and rebuilding the project fixes these issues for me.
Go to "Build", then "Clean Project." After that, go to "Build", then "Rebuild project."
Let me know if that works. If it doesn't, there are other possible solutions I can add.

java.lang.VerifyError: me.xxx.menu.MenuListFragment only on Android 2.x.x

after almost 2 week trying to solve this strange problem, I give up!
Basically a get the java.lang.VerifyError every time I try to run my app
only in devices with Android 2.x.x. From 3.x.x all are going well.
In the project I'm using this two external library:
Action Bar Sherlock - http://actionbarsherlock.com/ - updated at the v4.4.0
Sliding Menu - https://github.com/jfeinstein10/SlidingMenu
This is what the LogCat return every time:
FATAL EXCEPTION: main
java.lang.VerifyError: me.xxx.menu.MenuListFragment
at me.xxx.menu.BaseSlidingMenuActivity.onCreate(BaseSlidingMenuActivity.java:46)
at me.xxx.menu.SlidingMenuCustomAnimation.onCreate(SlidingMenuCustomAnimation.java:28)
at me.xxx.XXXActivity.onCreate(XXXActivity.java:130)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
and this is how the BaseSlidingMenuActivity.java looks like around the line 46:
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(mTitleRes);
// set the Behind View
setBehindContentView(R.layout.frame_content);
if (savedInstanceState == null) {
FragmentTransaction t = this.getSupportFragmentManager().beginTransaction();
mFrag = new MenuListFragment(); <--- ERROR HERE!
t.replace(R.id.frame_content, mFrag);
t.commit();
} else {
mFrag =(SherlockListFragment)this.getSupportFragmentManager()
.findFragmentById(R.id.frame_content);
}
...
...
}
Where MenuListFragment() is a SlidingFragmentActivity that extend a SherlockFragmentActivity
and implements SlidingActivityBase.
Of course I googled the problem, and seems that a lot of people are getting this
issue with the last version of the Android SDK tool, i.e. v22.x.x , in fact a have
the v22.6.3.
Some people resolved the VerifyError just putting the Check on the "Private Libraries"
box, inside "BuildPath->Configure BuildPath->Order and Export" menĂ¹, as explained
in other conversation about the VerifyError, but for me doesn't work, even because the "Private Libraries" was already checked. So the libraries/imports situation seems to be ok!
Hoping that someone already fund a solution for that! I'm getting crazy! :D
Thank you!
I finally found the solution!
Recap! Basically the are two main reason in which you can get this error:
(In my case) I was getting the VerifyError all the time that I tried to run my app on devices with API Level under 10 , because I was trying to catch an SQLiteDatabaseLockedException that are supported from the Android API Level 11. So to solve it check that every Exception or possible method (i.e. String.isEmpty() is supported from API Level 9) is supported form your minimum API Level.
While I was searching for a solution I found a lot of people that got the VerifyError because there was some problem with Libraries Imports, as explained in this post: http://commonsware.com/blog/2013/05/23/do-not-manually-modify-eclipse-build-path-except-now-r22.html
Hope that will help someone beyond me! :D
Bye Bye! Caterpillar.

Resources