have you declared this activity in your AndroidManifest.xml? - android

I want to use a third-party Android project in my project, so I exported the source of this third party project to a jar file and then imported the jar file to my project's Android Dependencies. I added this code in my class:
ComponentName componentName = new ComponentName(
"com.mobilevisualsearch",
"com.mobilevisualsearch.ActivityImageDetail");
String strImageSourcePath = "/storage/emulated/0/Camera/P40101-165253.jpg";
Bundle bd = new Bundle();
bd.putString("strPhotoFileFullName", strImageSourcePath);
Intent it = new Intent();
it.putExtras(bd);
it.setComponent(componentName);
startActivity(it);
com.mobilevisualsearch.ActivityImageDetail is a class of the third-party project. My AndroidManifest.xml was added as
<activity
android:name="com.mobilevisualsearch.ActivityImageDetail"
android:configChanges="orientation"
android:screenOrientation="portrait" >
</activity>
This<activity> is under <application>. When I run my app I get an error.
This is the Logcat log:
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.mobilevisualsearch/com.mobilevisualsearch.ActivityImageDetail}; have you declared this activity in your AndroidManifest.xml?
How can I fix this problem?

How can I fix this problem?
Step #1: Get rid of your ComponentName and the setComponent() call
Step #2: Replace your Intent initialization with Intent it = new Intent(this, ActivityImageDetail.class);, adding the import for ActivityImageDetail if needed

com.mobilevisualsearch.ActivityImageDetail
as it console notice you that class not found exception , Check that third party project is add to your project or not
try to import the ActivityImageDetail in your class and check is it exist or not
or if you are trying to open the third party application which is installed in your device, then no need to install in the manifest, check the app is exist or not in your device

Related

Importing Unity project into Android Studio

Okay, so I've tried to import my unity project as a single activity in Android Studio.
I've followed this
tutorial
but I kept getting an error at step 6:
"Unable to resolve dependency for ‘:app#debug/compileClasspath’: Could not resolve project..."
So I turned to another tutorial on a different way to import the aar package to my main project file in android studio.
Now, using both of the tutorials together, I managed to put something together that will compile without an error.
This is my main activity, where I want to start the unity activity on a button click:
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void startUnity(View view){
Intent intent = new Intent(this.getApplicationContext(), UnityPlayerActivity.class);
startActivity(intent);
}
}
The UnityPlayerActivity class is recognized by Android Studio, but when I run the app, I get this exception:
"Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.zackguetta.foodiedoodie/com.unity3d.player.UnityPlayerActivity}; have you declared this activity in your AndroidManifest.xml?"
How do I fix this? I thought the merge of the manifests would take care of this.
*note: I'm using Android Studio 3.0.1 if it means anything to you (maybe some compatibility issues arise)
*second note: Yes, I went through the other similar topics, none seemed to have the answer, so please don't mark as a duplicate right away.
Add it to your AndroidManifest.xml. Write this line inside <application> tags:
<activity android:name=".unity3d.player.UnityPlayerActivity" />

Android Studio unable to find explicit activity class Library After Merge Manifest

I Have Application where use library Pick Image. But When I use it like this :
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
new TedPermission(getApplicationContext())
.setPermissionListener(permissionGetFotoListener)
.setDeniedMessage("If you reject permission,you can not use this service\n" +
"Please turn on permissions at [Setting] > [Permission]")
.setPermissions(Manifest.permission.WRITE_EXTERNAL_STORAGE)
.check();
}
i got error :
android.content.ActivityNotFoundException: Unable to find explicit
activity class
{com.myapp.android/com.gun0912.tedpermission.TedPermissionActivity};
have you declared this activity in your AndroidManifest.xml
update
I used any Library.
This problem occurs when the added tools: node = "replace" on the manifest, but if it is removed, I get an error manifest merge failed
so how to fix it ?
add the activity to androidManifest.xml
or maybe the image pick library required their own activity to the manifest
<Application
.....>
<activity
android:name=".TedPermissionActivity"/>
</application>

How to use Android Service from other project?

I want to use an external project that is implemented as Android service. The service is used by adding it to the manifest:
<service android:name="com.my.ext.service"/>
But when I addthis line, I get the error:
Unresolved class 'TimerService' less... (⌘F1)
Validates resource references inside Android XML files.
And when I add the layout in my project:
<com.my.ext.service
android:id="#+id/myview"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
I get the error that
the class could not be found
I have imported the external service as an extra project into my Android Studio. How can I use the other project as a service for this project?
You can not use Your service class as XML layout.
You can use that service using
<service android:name="com.my.ext.service"/>
and execute that service from Main activity of your app using:
private Intent OtherService;
OtherService = new Intent((Context)this, (Class)YOURSERVICE.class);
MainActivity.this.startService(MainActivity.this.OtherService);

Gluon Charm Down Barcode Scanner - Intent handler not found

I am using Netbeans 8.1 and the gluonhq jfxplugin 2.2.0.
I am trying to read a barcode, and created a new project (the standard hello world). I changed the button handler to call a function UpdateText() (below) which in turn calls the Charm Down Scan service.
When I run the app, and click on the button I get the following error in the Android Device Manager:
E/AndroidRuntime(3583): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.gluonhq.charm.down.android.scan.SCAN cat=[android.intent.category.DEFAULT] flg=0x4080000 }
This crash is happening on the scanservice.scan() line.
Button click handler code:
protected void UpdateText(Label label) {
ScanService scanService = PlatformFactory.getPlatform().getScanService();
StringProperty scannedString = scanService.scan();
scannedString.addListener((obs, ov, nv) -> System.out.println("Scanned String = " + nv));
}
I would greatly appreciate any help
You need to define the com.gluonhq.charm.down.android.scan.SCAN intent in your AndroidManifest.xml file. Add the following activity definition below your main activity definition:
<activity android:name="com.gluonhq.charm.down.android.scan.zxing.CaptureActivity"
android:screenOrientation="sensorLandscape"
android:clearTaskOnLaunch="true"
android:stateNotNeeded="true"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="com.gluonhq.charm.down.android.scan.SCAN"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
By default, the AndroidManifest.xml file is generated for you under the hood by the plugin. If you haven't setup a custom AndroidManifest.xml file yet, you can copy the one that the plugin generates. The default version is located in build/javafxports/tmp/android/AndroidManifest.xml. Just copy that one to a persistent location, i.e. src/android. Then update your build.gradle to tell the plugin that it should use the custom AndroidManifest.xml file instead of generating the default one:
jfxmobile {
android {
manifest = 'src/android/AndroidManifest.xml'
}
}
update:
You also need to add an extra dependency to the zxing core library as it seems it isn't included automatically when depending on the charm library alone:
dependencies {
androidRuntime 'com.google.zxing:core:3.2.1'
}
Furthermore, you'll have to add the CAMERA permission to your manifest as well:
<uses-permission android:name="android.permission.CAMERA"/>

android Project add new activity error ?

I am having trouble adding new activity to my android Project because of this error
error MSG:
R cannot be resolved to a variable testActivity.java
I really want to know what is correct way to add new activity to my project and how to solve this error?
How to add a new activity:
Right click in your project
New > Class
Enter the name of your Activity.
In super class field: android.app.Activity
Also, make sure you clean your project, close Eclipse and launch it again.
Finally, double check that you included your new activity in your manifest file.
You need to clean your project a few times. Save the code and clean the project and make sure you have not used import andorid.R;

Categories

Resources