Unfortunately MyApp has stopped. How can I solve this..? - android-studio

This is my second question because the first question was not able to catch all classes
I develop begins,And I was stuck with this problem Unfortunately ____has stopped. How can I solve this?
this is logcat:
04-04 16:36:25.270 1906-1906/? I/art: Late-enabling -Xcheck:jni
04-04 16:36:25.496 1906-1926/com.example.user01.myapplicationnew D/OpenGLRenderer: Render dirty regions requested: true
04-04 16:36:25.508 1906-1906/com.example.user01.myapplicationnew D/Atlas: Validating map...
04-04 16:36:25.537 1906-1926/com.example.user01.myapplicationnew D/libEGL: loaded /system/lib/egl/libEGL_emulation.so
04-04 16:36:25.538 1906-1926/com.example.user01.myapplicationnew D/libEGL: loaded /system/lib/egl/libGLESv1_CM_emulation.so
04-04 16:36:25.541 1906-1926/com.example.user01.myapplicationnew D/libEGL: loaded /system/lib/egl/libGLESv2_emulation.so
04-04 16:36:25.574 1906-1926/com.example.user01.myapplicationnew I/OpenGLRenderer: Initialized EGL, version 1.4
04-04 16:36:25.629 1906-1926/com.example.user01.myapplicationnew D/OpenGLRenderer: Enabling debug mode 0
04-04 16:36:25.665 1906-1926/com.example.user01.myapplicationnew W/EGL_emulation: eglSurfaceAttrib not implemented
04-04 16:36:25.665 1906-1926/com.example.user01.myapplicationnew W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xe2b19200, error=EGL_SUCCESS
04-04 16:36:26.257 1906-1906/com.example.user01.myapplicationnew I/Choreographer: Skipped 34 frames! The application may be doing too much work on its main thread.
04-04 16:36:30.056 1906-1906/com.example.user01.myapplicationnew D/AndroidRuntime: Shutting down VM
04-04 16:36:30.056 1906-1906/com.example.user01.myapplicationnew E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.user01.myapplicationnew, PID: 1906
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.user01.myapplicationnew/com.example.user01.myapplicationnew.LoginActivity}; have you declared this activity in your AndroidManifest.xml?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1761)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1485)
at android.app.Activity.startActivityForResult(Activity.java:3736)
at android.app.Activity.startActivityForResult(Activity.java:3697)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:843)
at android.app.Activity.startActivity(Activity.java:4007)
at android.app.Activity.startActivity(Activity.java:3975)
at com.example.user01.myapplicationnew.MainActivity.onClick(MainActivity.java:51)
at android.view.View.performClick(View.java:4756)
at android.view.View$PerformClick.run(View.java:19749)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
this is my manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/Theme.AppCompat">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

This line in your logcat tells you what the problem is:
ActivityNotFoundException: Unable to find explicit activity class {com.example.user01.myapplicationnew/com.example.user01.myapplicationnew.LoginActivity}; have you declared this activity in your AndroidManifest.xml?
You didn't declare LoginActivity in your manifest.

Related

java.lang.RuntimeException: Unable to create service io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService

I am using Firebase Cloud Messaging for push notifications in a Flutter app using node.js + Typescript.
The FCM configurations for onLaunch and onResume were working fine, until I added Firebase dynamic links. Now, every time I receive a notification, the app crashes.
I have included click_action: 'FLUTTER_NOTIFICATION_CLICK' in the notification payload as well.
I do not have an Application.java file, I am using Flutter Android Embedding V2 (Flutter Version >= 1.12) and hence, no additional integration steps are required for Android.
Error:
D/AndroidRuntime(14785): Shutting down VM
E/AndroidRuntime(14785): FATAL EXCEPTION: main
E/AndroidRuntime(14785): Process: com.muffly, PID: 14785
E/AndroidRuntime(14785): java.lang.RuntimeException: Unable to create service io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService: java.lang.RuntimeException: PluginRegistrantCallback is not set.
E/AndroidRuntime(14785): at android.app.ActivityThread.handleCreateService(ActivityThread.java:4043)
E/AndroidRuntime(14785): at android.app.ActivityThread.access$1600(ActivityThread.java:229)
E/AndroidRuntime(14785): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1917)
E/AndroidRuntime(14785): at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(14785): at android.os.Looper.loop(Looper.java:226)
E/AndroidRuntime(14785): at android.app.ActivityThread.main(ActivityThread.java:7592)
E/AndroidRuntime(14785): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(14785): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
E/AndroidRuntime(14785): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
E/AndroidRuntime(14785): Caused by: java.lang.RuntimeException: PluginRegistrantCallback is not set.
E/AndroidRuntime(14785): at io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService.startBackgroundIsolate(FlutterFirebaseMessagingService.java:157)
E/AndroidRuntime(14785): at io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService.onCreate(FlutterFirebaseMessagingService.java:77)
E/AndroidRuntime(14785): at android.app.ActivityThread.handleCreateService(ActivityThread.java:4031)
E/AndroidRuntime(14785): ... 8 more
D/OOMEventManagerFK(14785): checkEventAndDumpForJE: 0
I/Process (14785): Sending signal. PID: 14785 SIG: 9
pubspec.yaml
firebase_core: ^0.5.0
firebase_auth: ^0.18.4+1
firebase_messaging: ^7.0.0-dev.15
firebase_dynamic_links: ^0.5.0+11
firebase_core: ^0.5.0
AndroidManifest.xml
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="#mipmap/ic_launcher" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="high_importance_channel" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with YOUR_SCHEME://YOUR_HOST -->
<data
android:scheme="https"
android:host="muffly.page.link" />
</intent-filter>
Create a separated file beside MainActivity.kt and name it Application.kt and type the following code inside it.
//Don't forget to change it to your app package name!!!
package com.your.packagename
import io.flutter.app.FlutterApplication
import io.flutter.plugin.common.PluginRegistry
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback
import io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService.setPluginRegistrant
class Application : FlutterApplication(), PluginRegistrantCallback {
override fun onCreate() {
super.onCreate()
setPluginRegistrant(this)
}
override fun registerWith(registry: PluginRegistry?) {
FirebaseMessagingPlugin.registerWith(registry?.registrarFor("io.flutter.plugins.firebasemessaging.FirebaseMessagingPlugin"));
}
}
Then, on your AndroidMainfest.xml add android:name=".Application" to your application tag
<application
...
android:name=".Application"
>
Finally, add firebase-messaging to your app/build.gradle.
dependencies {
...
implementation "com.google.firebase:firebase-messaging:20.1.0"
}

Freeswitch 1.8 and playback of tone_stream

I have an example dialplan in a form of:
<include>
<context name="application">
<extension name="play tone">
<condition>
<action application="log" data="INFO *****Playing tone1***** "/>
<action application="answer"/>
<action application="sleep" data="1000"/>
<action application="playback" data="tone_stream://%(1850,4150,475,425);loops=-1" />
<action application="hangup"/>
</condition>
</extension>
</context>
</include>
This bit works with Freeswitch 1.4 but is not working with Freeswitch 1.8, I am getting debug output like this:
2019-05-29 11:14:59.971372 [DEBUG] sofia.c:7291 Channel sofia/sip-profile/447872019798#127.0.0.1:5062 entering state [ready][200]
EXECUTE sofia/sip-profile/447872019798#127.0.0.1:5062 sleep(1000)
EXECUTE sofia/sip-profile/447872019798#127.0.0.1:5062 playback(tone_stream://%(1850,4150,475,425);loops=-1)
2019-05-29 11:15:00.971418 [ERR] switch_core_file.c:304 Invalid file format [tone_stream] for [%(1850,4150,475,425);loops=-1]!
EXECUTE sofia/sip-profile/447872019798#127.0.0.1:5062 hangup()
I have consulted documentation:
https://freeswitch.org/confluence/display/FREESWITCH/mod_tone_stream
https://freeswitch.org/confluence/display/FREESWITCH/Tone_stream
Not sure what to think and not sure where to look for some answers. Is it my configuration somewhere that disables tone_streams? Is it a bug in the new version?
For any hint or outright solution I would be grateful.

Gradle Project Sync Failed after updating to Android Studio 3.3.0

I haven't touched my Android Studio for a loooong time, it still worked fine when I launched it, but then I updated to 3.3.0 and I get a 'gradle project sync failed'. I know this is not trivial to debug via SO, but I tried to find anything similar and I lack of knowledge about the entire studio didn't help.
So maybe you can guide me to a solution, I'm not sure what files are necessary, but here is the actual error:
ERROR: Failed to parse XML in C:\Users\roberts\AndroidProjects\LingoFlash\app\src\main\AndroidManifest.xml
ParseError at [row,col]:[27,9]
Message: expected start or end tag
Affected Modules: app
This is the AndroidManifest.xml file:
20 <application
21 android:allowBackup="true"
22 android:icon="#mipmap/ic_launcher"
23 android:label="#string/app_name"
24 android:supportsRtl="true"
25 android:theme="#style/MyMaterialTheme">
26 //------------------------------------------------------------------------------------------
27 <activity android:name=".MainActivity">
28 <intent-filter>
29 <action android:name="android.intent.action.MAIN" />
30 <category android:name="android.intent.category.LAUNCHER" />
31 </intent-filter>
32 </activity>
so what's wrong at line 27? seems to point to the MainActivity
before I paste a ton of data, what would help to debug this?
Comments in xml files do not start with Double slash // they work with <!--Your comments-->. Your manifest is having lines that start with // remove them and try to clean and build your project.
Check if you have some wrong character found in the [27,9] position of the AndroidManifest.xml.
Refs: https://stackoverflow.com/a/52932622/8034839

Android Studio , Google MapFragment - mapv2

i know there are many question about this but it's about 2 days i work on this and i was unable to find a correct solution (i'm new to android). I need to create an app that can handle a map and draw some markers. I can't even show a map on my device :( Nexus4
This is what i have done :
i copy the google-play-services.jar into my libs dir and change the gradle.build to handle the new library :
dependencies {
compile files('libs/android-support-v4.jar' , 'libs/gcm.jar', 'libs/google-play-services.jar')
}
i already signed my app and enabled the mapv2 api and change the android manifest like this :
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
...
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<permission
android:name="com.metu.xxx.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.metu.xxx.permission.MAPS_RECEIVE"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="SIGNATURE_HERE -> ^_^"/>
...
my java class looks like this :
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class AtmActivity extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_atm);
}
}
my xml layout looks like this :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment
android:name="com.google.android.gms.maps.SupportMapFragment"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
compiling this code is ok but when i tap on the button to show the activity the app crash :(
This is the error log :
06-16 13:34:30.957 523-535/? E/qcom_sensors_hal: hal_process_time_resp: Resetting rollover count from 0 to 0
06-16 13:34:39.716 28726-28726/com.metu.xxx E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
at android.app.Activity.setContentView(Activity.java:1881)
at com.metu.xxx.AtmActivity.onCreate(AtmActivity.java:11)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Somebody can help me ?
or maybe can link a good how to to solve this ?
Thanks and sorry for my poor english :)
UPDATE :
it seems i completly wrong with this.
following this tutorial and everything went fine : http://android.rzeszow.net/?p=79
(there is a part missing in the copy files, you need to copy the jar and the settings to the libs file of the module)
You need to reference google play services project and not only the jar.

Recursive call to appender error using Log4j2 with Flume

I am using Log4j2 with the Flume appender with the following configuration:
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="debug" name="ALI" packages="">
<appenders>
<Flume name="eventLogger" suppressExceptions="false" compress="false">
<Agent host="localhost" port="4141"/>
<RFC5424Layout enterpriseNumber="18060" includeMDC="true" appName="com.weather.ali"/>
</Flume>
<RollingFile name="VTECs" fileName="logs/vtecs.log"
filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout>
<pattern>[%d{ISO8601}] %m%n</pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="250 MB"/>
</Policies>
</RollingFile>
</appenders>
<loggers>
<root level="debug">
<appender-ref ref="eventLogger"/>
</root>
<logger name="VTEC" level="debug">
<appender-ref ref="VTECs"/>
</logger>
</loggers>
</configuration>
This works as expected on a couple nodes, but the remaining nodes produce the following error:
ERROR Recursive call to appender eventLogger
Here is the full output of the Log4j bootstrap:
2013-05-07 09:21:59,033 DEBUG Calling createAgent on class org.apache.logging.log4j.flume.appender.Agent for element Agent with params(host="localhost", port="4141")
2013-05-07 09:21:59,040 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.RFC5424Layout for element RFC5424Layout with params(facility="null", id="null", enterpriseNumber="18060", includeMDC="true", mdcId="null", mdcPrefix="null", eventPrefix="null", newLine="null", newLineEscape="null", appName="com.weather.ali", messageId="null", mdcExcludes="null", mdcIncludes="null", mdcRequired="null", charset="null", exceptionPattern="null", Configuration(MyApp))
2013-05-07 09:22:02,148 DEBUG Generated plugins in 3.106963125 seconds
2013-05-07 09:22:02,156 DEBUG Calling createAppender on class org.apache.logging.log4j.flume.appender.FlumeAppender for element Flume with params(agents={host=localhost port=4141}, properties={}, embedded="null", type="null", dataDir="null", connectTimeout="null", requestTimeout="null", agentRetries="null", maxDelay="null", name="eventLogger", suppressExceptions="false", mdcExcludes="null", mdcIncludes="null", mdcRequired="null", mdcPrefix="null", eventPrefix="null", compress="false", batchSize="null", null, RFC5424Layout(facility=LOCAL0 appName=com.weather.ali defaultId=Audit enterpriseNumber=18060 newLine=false includeMDC=true messageId=null), null)
2013-05-07 09:22:02,159 DEBUG Starting FlumeAvroManager FlumeAvro[localhost:4141]
2013-05-07 09:22:02,552 DEBUG Calling createAppenders on class org.apache.logging.log4j.core.config.plugins.AppendersPlugin for element appenders with params(appenders={eventLogger})
2013-05-07 09:22:06,774 DEBUG Generated plugins in 4.221008626 seconds
2013-05-07 09:22:06,776 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="eventLogger", level="null", null)
2013-05-07 09:22:06,778 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for element root with params(additivity="null", level="debug", includeLocation="null", appender-ref={org.apache.logging.log4j.core.config.AppenderRef#55ed34f1}, properties={}, Configuration(MyApp), null)
2013-05-07 09:22:06,779 DEBUG Calling createLoggers on class org.apache.logging.log4j.core.config.plugins.LoggersPlugin for element loggers with params(loggers={root})
2013-05-07 09:22:06,779 DEBUG Shutting down OutputStreamManager SYSTEM_OUT
2013-05-07 09:22:06,779 DEBUG Reconfiguration completed
2013-05-07 09:22:07,237 ERROR Recursive call to appender eventLogger
So two questions:
Why would this work on some nodes and not on others?
I have looked at the code where this error is generated, and it appears to get called whenever the appender code gets called more than once. I see no reason why this should happen. Can someone explain this to me?
This turned out (not surprisingly) to be a flume configuration issue on the affected nodes. The Flume agents on those nodes were not starting properly, and this resulted in the fairly cryptic recursion error.
FYI, for others chasing similar log4j recursion warnings:
https://issues.apache.org/jira/browse/LOG4J2-2738

Resources