This is my second question in SO, I have a problem about Fatal Main error. Before I ask it, I found some other problem in SO, but what I found is about Facebook app
This is my error
java.lang.RuntimeException: applicationId is null. You must call Parse.initialize(context, applicationId, clientKey) before using the Parse library.
But, I have a class that declared it
package com.example.michael.eksperimen6chatting;
import android.app.Application;
import com.parse.Parse;
/**
* Created by Michael on 03/12/2015.
*/
public class ChattApp extends Application
{
#Override
public void onCreate()
{
super.onCreate();
Parse.initialize(this, "urkcFwvUmgSYvuOFTInJmkA3iWv0ArV3XT128TNb", "WvBC0cnGXHkVhTBbkFwLyxGDRgqR6qC8ft7DIleT");
}
}
and this is my manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.michael.eksperimen6chatting" >
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity android:name=".MainActivity" >
</activity>
<activity android:name=".UserList"></activity>
<activity android:name=".Login">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Chat">
</activity>
</application>
</manifest>
Did I miss something here, can anyone help me? Gratia
Specifying ChattApp Application class name in your AndroidManifest.xml's <application> tag.
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:name="com.example.michael.eksperimen6chatting.ChattApp">
....
</application>
import com.parse.Parse;
import android.app.Application;
public class ChattApp extends Application {
#Override
public void onCreate() {
super.onCreate();
Parse.enableLocalDatastore(this);
Parse.initialize(this, PARSE_APPLICATION_ID, PARSE_CLIENT_KEY);
}
}
AndroidManifest.xml
<application
android:name="com.example.michael.eksperimen6chatting.ChattApp"
.
.
.
</application>
Related
I think I have all the elements right in my Eclipse projects but I still receive this error:
java.lang.ClassCastException: android.app.Application cannot be cast
to cam.main.AnalyticsApplication
Here's the AnalyticsApplication code:
package cam.main;
public class AnalyticsApplication extends Application {
private Tracker tracker;
public AnalyticsApplication() {
super();
}
synchronized public Tracker getDefaultTracker() {
if (tracker == null) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
tracker = analytics.newTracker(R.xml.analytics);
}
return tracker;
}
}
Here's the Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cam.main"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="6"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:icon="#drawable/bot_img_1"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<activity android:name="cam.main.SplashScreen"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<- other activities from the app ->
</application>
<application android:name="cam.main.AnalyticsApplication">
</application>
</manifest>
And I have this code on the OnCreate method of my starting activity (StartMenu)
AnalyticsApplication application = (AnalyticsApplication) getApplication();
Tracker mTracker = application.getDefaultTracker();
I don't know if it's important but I have AnalyticsApplication and StartMenu in the same file.
Is there a need to create an Activity inside the AnalyticsApplication or something?
Just include your android:name="cam.main.AnalyticsApplication" parameter to an exist application tag like this:
<application
android:name="cam.main.AnalyticsApplication"
android:icon="#drawable/bot_img_1"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<activity android:name="cam.main.SplashScreen"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<- other activities from the app ->
</application>
Your custom Application class works incorrectly because of 2nd tag.
I am trying to send crash reports to email but when my app crashes nothing happens. I tried messing around with configurations but i just kept getting errors (unknown member mostly, wth that is). Here's my code for the class.
#ReportsCrashes(
mailTo = "me#gmail.com")
public class MyApplication extends Application
{
#Override
public void onCreate() {
super.onCreate();
// The following line triggers the initialization of ACRA
ACRA.init(this);
}
}
My manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ghostdevelopment.ueni2"
android:versionCode="1"
android:versionName="1.0"
android:debuggable="true">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="25" />
<application
android:name="MyApplication"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:label="#string/app_name"
android:name="com.ghostdevelopment.ueni2.MainActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="Ship Database"
android:name=".ShipInfo" />
</application>
</manifest>
According to your logcat it appears that your app has not included the ACRA library. You need to configure your build so that ACRA is included in your APK.
I am trying to connect my android application to parse.com but I am stuck at last step.On Parse website it is mentioned Add the following to your ApplicationonCreate():
Parse.enableLocalDatastore(this);
Parse.initialize(this, "yDdwwIjw0jmTnTEAzc3CQaXXXXXXXXXXXX", "kljfnAt3XXXXXXXXXXXX");
I am unable to understand how and where to add this code.Please guide through the steps.
Create Application class inside main package
public class MyApplication extends Application{
#Override
public void onCreate() {
super.onCreate();
Parse.initialize(this, getString(R.string.parse_app_id), getString(R.string.parse_client_key));
}
}
Add permissions to your Manifest file.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Create a class which extends the Application class
public class MyApp extends Application {
#Override
public void onCreate() {
super.onCreate();
Parse.initialize(this, getString(R.string.parse_application_id), getString(R.string.parse_client_key));
}
}
Don't forget to add android:name=".MyApp" to the application in your Manifest file.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:name=".MyApp" >
<activity
android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
I'm working on an android project in which one of the activities includes a Maps view. I'm only after doing the code for displaying a simple Google Map but I bumped into this NoClassDefFoundError. I have checked some similar questions and tried the suggested solutions but still won't work. I have activated the Internet permision in the manifest file and the user library for the application. Does anyone have any suggestions on what might be the problem? Here's the activity code:
package com.mad.mylit;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
public class LocationsActivity extends MapActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.location);
}
#Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
And here's my manifest file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mad.mylit"
android:versionCode="1"
android:versionName="1.0" android:installLocation="auto">
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:icon="#drawable/icon"
android:label="#string/app_name" >
<uses-library android:name="com.google.android.maps"/>
<activity
android:name=".MyLitActivity"
android:label="#string/app_name"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MapsActivity"></activity>
<activity android:name=".MyProfileActivity"></activity>
<activity android:name=".BusActivity"></activity>
<activity android:name=".EventsActivity"></activity>
<activity android:name=".LocationsActivity"></activity>
<activity android:name=".NotesActivity"></activity>
<activity android:name=".TimetableActivity"></activity>
<activity android:name=".MondayActivity"></activity>
<activity android:name=".TuesdayActivity"></activity>
<activity android:name=".WednesdayActivity"></activity>
<activity android:name=".ThursdayActivity"></activity>
<activity android:name=".FridayActivity"></activity>
<activity android:name=".CaherdavinActivity"></activity>
<activity android:name=".RaheenActivity"></activity>
<activity android:name=".UniversityActivity"></activity>
<activity android:name=".SplashScreen"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
All of the activities are in the same package.
Try to get new maps API key with your personal keystore.
Have you recently updated your ADT plugin?
Here and here are some talks about same prblem..
I have developed a little project using just one Activity, and now, I'm trying to add a new one, but, I recieve this error when I'm trying to launch the project on my device:
Running com.android.gl2jni/.TestActivity... 1> Starting: Intent {
cmp=com.android.gl2jni/.TestActivity } 1> 1>
java.lang.SecurityException: Permission Denial: starting Intent {
flg=0x10000000 cmp=com.android.gl2jni/.TestActivity } from null
(pid=2935, uid=2000) requires null
I'm not trying to call the new Activity, and I have developed an empty Activity to check why I can't launch the app.
This is my Manisfest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.gl2jni">
<uses-feature android:glEsVersion="0x00020000"/>
<uses-sdk android:minSdkVersion="9"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<application
android:label="#string/gl2jni_activity">
<!--main activity-->
<activity android:name=".GL2JNIActivity"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:configChanges="keyboardHidden"
android:screenOrientation="landscape"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!--BT device list activity-->
<activity android:name=".TestActivity"
>
<intent-filter>
</intent-filter>
</activity>
<!--
<activity android:name=".BluetoothDeviceListActivity"
android:label="#string/select_device"
android:theme="#android:style/Theme.Dialog"
android:configChanges="keyboardHidden"
android:screenOrientation="landscape"
/>
-->
</application>
</manifest>
And this is the empty activity class:
package com.android.gl2jni;
import android.app.Activity;
import android.util.Log;
import android.os.Bundle;
public class TestActivity extends Activity {
#Override protected void onCreate(Bundle icicle) {
LogConsole.print( "HI, I AM TestActivity" );
}
}
I suppose that I have to modify something else more, but I don't know what...
Thanks in advance for the help.
You've specified an empty intent filter for TestActivity. An empty intent filter matches NO intents. Remove these lines from the block for TestActivity:
<intent-filter>
</intent-filter>
Also, in onCreate() of TestActivity you must call super.onCreate(), otherwise Android will crash it.