I've been following this tutorial to create an android game. I downloaded the skeleton he provided but changed one of my packages from robotgame to highst. Whenever I try and deploy the application with the example code to my device I get the following error.
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.ronyo.robotgame/com.ronyo.highst.Loader }
Error type 3
Error: Activity class {com.ronyo.robotgame/com.ronyo.highst.Loader} does not exist.
I've searched for an instance of robotgame in my project and I can't find an instance of it. The tutorial above is created using Eclipse and I'm porting it to Android Studio. I'm wondering if I've overlooked something when switching IDEs?
Here is my AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ronyo.highst"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<application
android:icon="#drawable/icon"
android:label="Loader" >
<activity
android:name=".Loader"
android:configChanges="keyboard|keyboardHidden|orientation"
android:label="Loader"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.inten.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Delete the folders .idea and .gradle then click button "Sync project with gradle files"
It looks like the package wasn't updated everywhere. Have you changed anything in the manifest?
In the AndroidManifest.xml file, in the <manifest tag, there should be a package attribute. That needs to be updated to match your new package name, com.ronyo.highst.
Check out the documentation here: http://developer.android.com/guide/topics/manifest/manifest-element.html
don't change it directly , It'll not update all the references, use this
right click on project > Android tools > Rename application package
Related
I am working in Android 2.3.3, and have run into this error: "Tag manifest attribute package has invalid character'_'. Initially, I was getting this error because my package name contained an underscore (com.isco_pipe.www.fieldtechapp). I have since renamed the package and removed the underscore (as you can see in the manifest file below). But the error persists upon an attempt to rebuild. Any thoughts?
Here is my AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.iscopipe.www.fieldtechapp">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application android:allowBackup="true" android:icon="#mipmap/ic_launcher"
android:label="#string/app_name" android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true" android:theme="#style/AppTheme">
<activity android:name="com.iscopipe.www.fieldtechapp.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Note: I previously asked a question about not being able to debug my app on my device (running Android Studio on a virtual machine). I am now attempting to setup and run my app in Android Studio directly on my Windows laptop to see if I can run the app on an emulator and debug from there. Unable to attach debugger to Android process in Android Studio 2.3.3
Check your build.gradle file also, what you gave in applicationId.
Make sure that you are editing the proper file. Android Studio has the absolutely aggravating "feature" where certain errors cause a file in build/ to pop up in the editor. In your case, it would be a merged manifest, not your actual manifest. Editing files in build/ will have no effect, as they get re-created on each build. So, make sure that you have modified your actual manifest (e.g., src/main/AndroidManifest.xml).
I'm creating a kind of complex app that has multiple dependencies, I was using newrelic for a while with no problems, after that I wanted to add ZenDesk to the app, but when initializing the SDK , I was receiving a new relic error which was too weird! I tried for the sake of testing to remove newrelic from the app completely, so I removed compile 'com.newrelic.agent.android:android-agent:5.3.1' from the gradle file
the app doesn't work at all now! it crashes on start showing the error in the title:
java.lang.ClassNotFoundException: Didn't find class *.*.MainActivity
when I add the newrelic back the app starts to work again!
I tried to to some digging about the problem and I found few suggestions about stopping gradle and cleaning the project and so saying the problem is probably a gradle cash or so, I tried everything, I even tried it on another machine, the problem persisted !
any ideas what is wrong??
EDIT:
manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:supportsRtl="true">
<activity
android:name="com.myapp.Main.MainActivity"
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="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
</application>
</manifest>
android:name="com.myapp.Main.MainActivity"
I guess it is wrong
It will
android:name="com.orderme.MainActivity"
The ClassNotFoundException is thrown when the Java Virtual Machine
(JVM) tries to load a particular class and the specified class cannot
be found in the classpath. The ClassNotFoundException is a checked
exception and thus, must be declared in a method or constructor’s
throws clause.
What is the way
Verify that the name of the requested class is correct and that the
appropriate .jar file exists in your classpath. If not, you must
explicitly add it to your application’s classpath.
In case the specified .jar file exists in your classpath then, your
application’s classpath is getting overriden and you must find the
exact classpath used by your application.
In case the exception is caused by a third party class, you must
identify the class that throws the exception and then, add the
missing .jar files in your classpath.
Eclipse - java.lang.ClassNotFoundException
As always, the solution is 99% stupid when it comes to programming XD
at the top of my gradle file there was this:
apply plugin: 'newrelic'
I just removed this line and it works now .
I have developed a new application for Android and my application is completed. It doesn't have any errors except for a few (2) harmless warnings. I created an .apk package using the tools available in ECLIPSE. It created a key and an .apk file. Created all right. BUT when I upload the .apk file I get an error telling that I cannot use the following in front of the package name :[com.android,com.goolge,android,com.example]
Below is my manifest details
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.Scheduler"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7"/>
<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.WRITE_EXTERNAL_STORAGE"/>
<application
android:icon="#drawable/icon"
android:label=".SchedulerActivity" >
<activity
android:label="#string/app_name"
android:name=".SchedulerActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".addSubject"/>
<activity android:name=".Assignment"/>
<activity android:name=".CameraTake" android:screenOrientation="landscape"/>
<activity android:name=".view_details"/>
<activity android:name=".about"/>
<activity android:name=".help"/>
<activity android:name=".MyAlarmService"/>
<activity android:name=".Assignment_view"/>
<receiver android:name=".MyAlarmService" />
</application>
I tried some methods that are explained in here but it didn't work. Can anyone help me?
It is because of
package="android.Scheduler"
that you are getting this problem.
Notice in your file browser that you probably have src > android > scheduler
you cannot have android there.
all I can think of for a quick fix, is start a new project FROM that one, and in the setup set the package name to com.something.yourappname, but where "something" is do not include "google" or "android"
You have choosen incorrect package name "android.Scheduler", just change your package name.
For eg. if your name is "ravi" then choose package name something like this-
"com.ravi.scheduler".
Steps change package name (eclipse):-
Under your project folder just go to "src" then here you found "android.Scheduler" right click on it, choose "Refactor" -> "rename" & then write your desired package name like "com.ravi.scheduler" & click OK.
Now Rebuild/Run your project & then do application signing.
Now you are ready to upload your app to Google Play.
I went through all the articles about the INSTALL_FAILED_MISSING_SHARED_LIBRARY issue in Google Maps projects but I couldn't find a case similar to mine nor a solution, so here is my problem:
I have a project with an activity (com.example.googleMaps.AndroidGoogleMapsActivity) that inherits from MapView to show a Google Map and do some stuff.
I run it on a Samsung Galaxy S II and it works fine: it shows the map and does the stuff it is supposed to do.
Now.
I want to use this project as a library for another project and show that activity as the first screen of another app.
So I checked the box Is Library, I created a new android project that builds against GoogleAPI and includes the library in the Android properties in Eclipse with the following manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="test.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-sdk android:minSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<uses-library android:name="com.example.googleMaps" required="true" />
<uses-library android:name="com.google.android.maps" required="true" />
<activity android:name="com.example.googleMaps.AndroidGoogleMapsActivity"
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>
</manifest>
I run this new project on my device and I get the infamous error:
INSTALL_FAILED_MISSING_SHARED_LIBRARY
and LogCat is totally silent.
I would like to point out that the activity inside the library works so none of the well know issues should apply.
In the client project I specify two uses-library tags (one for my library and one for the Google library), I build against GoogleAPI, include the library in the Android properties in Eclipse and run on a tested device.
Am I still missing something?
I had the same problem, just remove the line:
<uses-library android:name="com.example.googleMaps" required="true" />
and it should work.
Only Use com.google.android.maps. Please remove another one.
I have created an Android Library Project which contains several Activities. I want to reuse these activities in other projects. How can I do this? I have added the project vi:
project->Android->Add(Android Library Project.)
Then added the required details to Android Manifest file.
Android Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.testlib.com"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="9" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-libraryandroid:name="org.mainlib.com" android:required="true"/>
<application android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity android:name=".TestLibActivity"
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="org.mainlib.com.MainActivity"/>
</application>
</manifest>
Code to start activity:
Intent myintent=new Intent(v.getContext(),MainActivity.class);
startActivityForResult(myintent, 0);
How can I invoke an activity from my jar file?
I don't understand your question. Do you mean
How to start 'TestLibActivity' from outside the Library
?
If that's the case, you can call it by calling Intent myintent=new Intent(v.getContext(),org.testlib.com.TestLibActivity.class);
startActivityForResult(myintent, 0);
Of course you have to add the right import in your activity and add the library to your project.
If you've created an android library and added it correctly (seems like it). Then the only thing you do is the same thing you'd do with a regular activity. The only difference being you import a path from your library project instead of your own project.
On a side note you don't need to add the library in your manifest. You only need add the library project through the project properties.