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

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>

Related

Branch.io does not work with multidex because of manifest conflict

Branch wants me to use the "android:name" in the manifests file, but I already use it for multidex. So, how to overcome this conflict?
<application
...
//android:name="io.branch.referral.BranchApp"
android:name="android.support.multidex.MultiDexApplication"
...
</application>
This is the entire code of BranchApp:
public class BranchApp extends Application {
#Override
public void onCreate() {
super.onCreate();
if (BranchUtil.isTestModeEnabled(this) == false) {
Branch.getInstance(this);
} else {
Branch.getTestInstance(this);
}
}
}
Make a custom Application class that extends MultiDexApplication, and use this override for the onCreate and you're good.
The Branch SDK has its own custom activity and application class. Other plugins that use their own custom activity and application classes can cause "conflicts" between these classes. To resolve these conflicts:
Create an empty android library
Add the Branch plugin along with the other plugins into your project
Create a custom Activity and Application class that will contain the custom logic for all your plugins
Build your library
Add your library into Unity project
Change android:name to name of your custom Application class in the application tag of your Manifest
Change android:name to name of your custom Activity class in the activity tag of your Manifest
Some Plugins expand the default AppController the same was as Branch does like Cardboard SDK plugin. To resolve conflicts:
Merge all custom AppControllers in one.
Comment code in other AppControllers (or delete other AppControllers).
Here are some Code Samples for resolving conflicts with other 3rd party plugins
If you still face any issues, please write to integrations#branch.io with the details.

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" />

Application class in a module's manifest

I have added a module within my project and created an Application class which was added to the module's manifest.
public class App extends Application {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
#Override
public void onCreate() {
super.onCreate();
Fabric.with(this, new Crashlytics());;
}
}
Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mymodule">
<application
android:allowBackup="true"
android:label="#string/app_name"
android:name="com.example.mymodule.App">
</application>
</manifest>
The problem is that I get no suggestions when trying to set the name of my application class within the Manifest. Any ideas why?
EDIT: I already have an Application class in my app module. The reason why I'm doing this is because I want to add a library in that module. How can I achieve this?
You need to type . (dot) and then you will get the suggestion. Like below
android:name=".App"
If you application class is within any package then the name will be
.[package name].[Application class]. If it is outside the any package the just the Application name.If still the problem exist then restart the studio sync,rebuild and clean it and check it once again.Hope this will help you.

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"/>

have you declared this activity in your AndroidManifest.xml?

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

Categories

Resources