i have a application on java + c++.
IDE is - visual studio with android plugin.
i have 2 activity : 1-nativeActivity , 2- activity on java.
activity on java is main.
after java activity i start nativeactivity. in java activity there are a purchase manager. i want call to him from a native activity.
<activity android:configChanges="orientation|keyboardHidden" android:name="android.app.NativeActivity"
android:label="#string/app_name" android:theme="#android:style/Theme.Translucent">
<meta-data android:name="android.app.lib_name" android:value="main" />
</activity>
<activity android:name="BillingActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
in onCreate BillingActivity i start nativeActivity.
in native activity i do
jclass billing = env->FindClass("Lcom/crystalreality/crystaltv/BillingActivity;");
but i have
jclass billing = env->FindClass("Lcom/crystalreality/crystaltv/BillingActivity;");
05-20 16:40:55.061: W/System.err(28592): java.lang.NoClassDefFoundError: Lcom/crystalreality/crystaltv/BillingActivity;
The correct usage of FindClass is something like this:
env->FindClass("com/crystalreality/crystaltv/BillingActivity");
I suspect you don't need the "L" at the beginning (and ";" at the end) of your class sig.
jclass billing = env->FindClass("com/crystalreality/crystaltv/BillingActivity");
You should only need L...; form sigs if you're looking for an array class. That's my understanding from these lines of documentation.
Failing that, have you used any obfuscation java-side?
Related
I have 2 project (A and B) A is the sdk and the other is an application that uses sdk.
I want to join A to B with gradle and i don't know how.
Thanks
you need to show a new MainActivity instance you need to declare an intent-filter in your project B manifest:
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="your.package.here.MainActivity" />
<category android:name="android.intent.category.DEFAULT" />
I am trying to implement Barcode scanner within my APP building it out of ZXING sources.
I have taken the latest available Zxing sources and now I have it as a Android Library Project. I also have successfully referred this Library from my application.
However at run time I am getting resources not found exception.
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.android.m2m/com.google.zxing.client.android.CaptureActivity}:
android.content.res.Resources$NotFoundException: File res/xml/preferences.xml from
drawable resource ID #0x7f050000
I have mentioned about the CaptureActivity in my Applications's Manifest XML also..
<activity
android:name="com.google.zxing.client.android.CaptureActivity"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="landscape"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="com.google.zxing.client.android.SCAN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Is there anything that i am suppose to do ,so that the resources within the Zxing sources can be picked up ?
I got the solution.
The problem is the source of zxing is not intended to be used as a Library..Got the answer by Sean in the below thread.
Zxing project as library in a project won't build
I tried bridling my app within this CaptureActivity project adding my activity and resources and modifying its manifest File accordingly.
Are you using the R class from the ZXing in your activity code ? Sometimes it's just an import problem.
Hi i've added the AndroidAnnotations and configured it; it generates the activity with the underscore _ as suffix, but when I try to lunch the app, it gives this error
05-26 04:17:23.524: E/AndroidRuntime(5096): java.lang.RuntimeException:
Unable to instantiate activity
ComponentInfo{android_app.candgo/android_app.candgo.HelloAndroidActivity_}:
java.lang.ClassNotFoundException: Didn't find class
"android_app.candgo.HelloAndroidActivity_"
on path: /data/app/android_app.candgo-1.apk
Any suggestion about why it doesn't work
PD: I've ADT v22
PD: I've the HelloAndroidActivity_ registered at manifest
This is my manifest.xml (sorry for the delay)
<uses-sdk android:minSdkVersion="8"
android:targetSdkVersion="16" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name="MainActivity_">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
You need to add the ".apt_generated", or whichever folder AA outputs to, to your source directories listing. In Android Studio, you can find this in Project Settings -> Modules -> module_in_question -> Sources
Check your manifest file for a entry of the activity. Check the name.
If you updated ADT to rev 22. you can try this java.lang.ClassNotFoundException after changing nothing in the project but upgrading eclipse android sdk.
Check the package name in manifest
<manifest package="com.example.mypackaganame" //check the name
Check under application tag for the activity entry
<activity
android:name="com.example.mypackaganame.MainActivity"
// this is the main activity
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Say you have second Activity. This how you declare for implicit intents
<activity
android:name="com.example.mypackaganame.SecondActivity"
// this is the Second activity
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.example.mypackaganame.SecondActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Foe explicit intents
<activity
android:name=".SecondActivity"
// this is the Second activity
android:label="#string/app_name" >
</activity>
you need to register the activity class(AndroidAnnotations) in your manifest.xml,like:
<activity android:name = "com.your.packageName" android:screenOrientation="portrait" android:configChanges = "orientation"/>
then you can use it.
If you are using Eclipse follow these steps :
Step 1.
Go to Java Compiler and make sure that Compiler compliance level is set to 1.6, otherwise the processor won't be activated
Step 2.
Go to Java Compiler > Annotation Processing and choose Enable annotation processing
step 3.
Go to Java Compiler > Annotation Processing > Factory Path and add the processor JAR : androidannotations-X.X.X.jar.
step 4
Confirm the workspace rebuild
Hi I have an activity defined in my Library like so...
<activity
android:name="com.company.application.corelibrary.recording.DesiredActivity"
android:label="#string/title_activity_tracking"
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I then want to use this library to launch with in another application which I am doing like so...
<activity
android:name="com.company.application.corelibrary.recording.DesiredActivity"
android:label="#string/title_activity_tracking"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
However when I am going to build it it comes back with...
[2013-02-27 12:41:33 - TestApplication] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.company.application/.corelibrary.recording.DesiredActivity }
[2013-02-27 12:41:33 - TestApplication] ActivityManager: Error type 3
[2013-02-27 12:41:33 - TestApplication] ActivityManager: Error: Activity class {com.company.application/com.company.application.corelibrary.recording.DesiredActivity} does not exist.
com.company.application is my project package.
com.company.application.corelibrary is my library package.
I have included the library in my project.
What am I doing wrong?
ADDITION
I just renamed my library project's package name to something different than that of my project as I thought maybe as they were similar the project may look in it own source for the class but this did not work either.
in my application, i have wrote activity in manifest like:
<activity android:name="MainActivity"
android:label="#string/app_name"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
i have also declare another activity (which activity belongs to my library) in the manifest as:
<activity android:name="com.facebook.LoginActivity"
android:label="#string/app_name" />
hope this will help u.
N.B:
u should not use
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
for two activity in a manifest.
I thought I would answer my own question. The other answers may be valid but this is what solved mine.
Before my activity declaration in the new projects manifest I had the following which was causing issues.
<uses-library
android:name="com.corecoders.st.corelibrary"
android:required="true" />
I removed that, cleaned and rebuilt the project and it launched fine.
I have solved this issue by implemeting he solution io.card does in their library. By wrapping with the application tags the activities into your library manifest.
<application>
<activity
android:name="com.eckoh.eckohroute.ActionConsumingActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="#style/Theme.Dialog.ActionActivity" />
</application>
I got this warning from console when running my application on emulator
No Launcher activity found!
The launch will only sync the application package on the device!
In fact i have declared an activity as the main launcer in AndroidManifest.xml file
<activity
android:name=".myActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I don't need any other intent-filter to use on that activity.. just basic main and launcher
What's the reason? Please give me a solution..
If the launcher activity is in another package, you will need to specify that as well.
For instance, from one of my personal projects:
<activity
android:name=".activities.MainScreen"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The MainScreen.java is in the activities package. Also, check spelling for upper or lower case letters.
It seems that you must have "android.intent.action.MAIN" specified immediately before "android.intent.category.LAUNCHER". I encountered the same issue as you when I had the following:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
The issue was resolved only when I re-orderd as follows:
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
In all normal circumstances, listen to what the other guy(s) said.
I was able to replicate your issue using a Mac Book Pro & Eclipse Indigo. when you create your android project, you MUST have Eclipse start you off with a templated activity (like a blank activity). if you don't, and you try to add an activity to your manifest later, Eclipse just derps and can't find the launcher. (i looked at other manifest files and i can't see any differences. i really don't think it's your poor manifest's fault in this special case.)
here's your lazy easy fix:
start a new project, and copy over all the files (make sure you back up ur files first, in case you delete something wrong or mess up the ordering)
Using Eclipse Indigo, open Run Configurations windows, click the project and use launch default activity on Android tab, choose Automatically pick compatible device...and apply.