Error: Could not find MyFirstApp.apk - android

I am following he tutorial from this site: http://developer.android.com/training/basics/firstapp/creating-project.html, but when I run the default program in eclipse when an android project is created, it gives me the error R could not be found. To fix this, I commented out the lines with R and ran it again, but now it gives me the error: Could not find MyFirstApp.apk!... I have tried all other solutions on this site, but none of them work. If anybody knows how to fix this, please let me know!
here is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.myfirstapp.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>
</application>
</manifest>

When your .R class could not be found, there is an error in your project - commenting out the lines with the .R class does not fix the problem.
Perhaps you just have to clean your workspace (Project > Clean...) or delete the bin and gen folder in your project, they should be rebuilt automatically.
Look at the Problems tab next to the Console tab where you get the errors and take a look at the messages.

when I had originally installed the android sdk it installed to some folder in my filesystem. I moved the SDK manager to a folder on my desktop, and installed updates through there. I had to change my android path to that folder, and everything fixed! Thanks for your help though, it was much appreciated.

Related

APK not running on real device - Manifest error?

I am new on app's code. My project runs perfectly on emulators. However the apk is not running in my samsung device. Checking it with the Android Studio Analyzer the line xmlns:android="http://schemas.android.com/apk/res/android" in the manifest.xml returns in red. It seems that something is wrong with my project Manifest. Any Help? My manifest is copied below.
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
package="com.ferleecidade.a100dia11">
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="26" />
<application
android:theme="#ref/0x7f0f0005"
android:label="#ref/0x7f0e001f"
android:icon="#ref/0x7f0c0000"
android:debuggable="true"
android:exported="true"
android:allowBackup="true"
android:supportsRtl="true"
android:roundIcon="#ref/0x7f0c0002">
<activity
android:name="com.ferleecidade.a100dia11.MainActivity">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.ferleecidade.a100dia11.MyCustomList" />
<meta-data
android:name="preloaded_fonts"
android:resource="#ref/0x7f020003" />
<meta-data
android:name="android.support.VERSION"
android:value="26.1.0" />
<meta-data
android:name="android.arch.lifecycle.VERSION"
android:value="27.0.0-SNAPSHOT" />
</application>
</manifest>
Help? Yes.
I am actively looking into this right now.
I don't believe your manifest is causing this or at least isn't the sole cause.
I have a project that I can run on my devices and emulators and deploy without a glitch.
I also get an error on the same line you do when analyzing the APK (Build/.Analyze APK).
If you hover your cursor over the red text you will see your error popup.
Mine says "URI is not registered (Settings | Languages and Frameworks | Schemes and DTDs)"
I performed a quick experiment.
created a brand new project in Android Studio with a single activity.
Cleaned the project.
Ran in an emulator.
Generated a signed APK.
Analyzed the APK and the error is there.
I suggest you try this.
This leads me to believe one of two things.
There is something wrong with my default project settings.
The error is being incorrectly reported by Android studio.
I hope this was useful.

Android. No Launcher Activity found

I keep getting this message when trying to run the emulator, even though I've put the launcher activity in my manifest.
Does anyone have an idea what I'm doing wrong?
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.libsdl.app"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="org.libsdl.app.SDLActivity"
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>
Resolved: After some more mucking around in my files, I found that there were multiple AndroidManifest.mk files and I had put the activity in the wrong one. (I had this in the mk file located in the bin folder, instead of the one in root.)
I was having this same issue, and the OP's edit at the bottom of the post was what fixed it. (I would have upvoted, but I do not have any reputation points at this time).
To clarify for anyone in the future: it appears that Eclipse will automatically create a duplicate of the AndroidManifest.xml in the bin directory. This copy is automatically generated off of the one you are supposed to edit on the root directory.
If you edit the manifest in the bin directory, Eclipse will not give you any warning that you are editing the wrong file. You can even save to it, and run validate to ensure that there are no errors. When you run the program, it will actually be overwritten, but for some reason Eclipse tends not to prompt you that the contents have been overridden while you still have the file open.

android.support.v8 cannot be resolved

I am trying to use renderscript in my Android project. I installed sdk tools 22.6.2 and sdk build tool 19.0.3 and then updated my adt to the latest version. But now I get error that
"The import android.support.v8 cannot be resolved" on the line where I wrote import android.support.v8.renderscript.*. I have also made the following changes in projects.properties
renderscript.target=18
renderscript.support.mode=true
sdk.buildtools=19.0.3
manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.amazing.imazing"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.amazing.imazing.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>
</application>
I am new to Android programming.
I removed all the entries from the project.properties except the one 'target=android-18' and copied the renderscript-v8.jar to the libs folder of my project. I found this jar file in sdk/build-tools/18.1.0/renderscript/lib. I stopped getting that error.
I repeated this process in another project and it works.
Try this
renderscript.target=18
renderscript.support.mode=true
sdk.buildtools=18.1.0
Which IDE are you using? Pay attention to the fact that Android Studio/Gradle-based builds are not yet supported by the RenderScript support library.
In addition, IntelliJ IDEA ignores the project.properties file, even if you are using the default build system ("make").

Android/Sony Smartwatch: Unable to instantiate receiver (ClassNotFoundException)

I got an ClassNotFoundException with a static broadcastreceiver. The exception is fired when installing the app via eclipse on the device. I am developing an sony smartwatch extension, so I need to use the "SmartExtensionUtils" project from the sony sdk. As long as I was working inside the code example project everything was fine. I started a new project with Maven + Android and now it is no longer working!!! No idea why?!? I reckon something with the packages went wrong....
I got the following error:
E/AndroidRuntime(11201): java.lang.RuntimeException: Unable to instantiate receiver com.bla.move.smartwatch.sony.ExtensionReceiver: java.lang.ClassNotFoundException: com.bla.move.smartwatch.sony.ExtensionReceiver
My broadcastreceiver class is called ExtensionReceiver. The name inside the manifest file is the same ...
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bla.move.smartwatch.sony"
android:versionName="1.0" android:versionCode="1">
<uses-sdk android:minSdkVersion="7"/>
<uses-permission
android:name="com.sonyericsson.extras.liveware.aef.EXTENSION_PERMISSION" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name="SmartWatchPreferenceActivity" android:label="#string/preference_activity_title">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<service android:name=".SmartWatchExtensionService" />
<receiver android:name=".ExtensionReceiver">
<intent-filter>
.....
</intent-filter>
</receiver>
....
What could be the problem? Any suggestions??? I did alreday clean + rebuild (a couple of times)!
Did you include the SmartExtensionAPI and SmartExtensionUtil projects as dependencies, both in your project and in Maven?
Try cleaning the workspace (start Eclipse with the -clean flag), and make sure your project's JDK compliance settings is set to 1.6 (not 1.7)! That worked for me. I set the JDK compliance level of the whole workspace, instead of the project itself, and the error just disappeared!

Eclipse - new android activity showing in manifest but missing under src

I created a new blank activity from Eclipse's 'New' menu.
I didn't get any errors, and the activity looks to have been correctly populated in the manifest, however, no java class file has been created.
I get the impression that within Eclipse, the class should have been auto-created and auto-populated with the onCreate and onOptionsItemSelected method templates.
Why didn't Eclipse automatically create the class for me?
Manifest code as requested:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstandroidapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.myfirstandroidapp.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.example.myfirstandroidapp.DisplayMessageActivity"
android:label="#string/title_activity_display_message"
android:parentActivityName="com.example.myfirstandroidapp.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.myfirstandroidapp.MainActivity" />
</activity>
</application>
The fastest solution: keep the Activity in your manifest, but create the java class by right-clicking your package -> new -> class -> DisplayMessageActivity and then extend the Activity class and add the missing methods. Note that the class name have to match the one declared in the manifest
EDIT
After you've done it, clean the project by selecting project -> clean and check if there are any error messages left
I needed to uninstall Eclipse and install the sdk (adt bundle) from http://developer.android.com/ which comes bundled with eclipse to resolve this issue.
I found that my original set-up not only failed to create source files, but was also unable to create new android projects, even though it managed to create the first project successfully. Something must have happened to ruin the set up, no doubt, something I did but cannot trace.
What worked for me...
In eclipse, go to Help >
Install new software... > Work with: https://dl-ssl.google.com/android/eclipse/
Hit enter, checkmark "Developer Tools" and "NDK Plugins".
Let it download and install. I had to delete "myfirstapp" and remake it.
Restart Eclipse once it has downloaded and installed.
Having that issue and actually doing it over again helped me understand more about the syntax used in the lessons that I've already been through before.

Categories

Resources