• Chidambar Kulkarni
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 4
    Replies
I am new to cordova (& salesforce),I have an app which doesn't have much code. After following this tutorial 

https://trailhead.salesforce.com/en/project/mobile-sdk-hybrid-apps/mobilesdk-hybrid-apps-02

When I open the app it displays "Unfortunately, "test6" has stopped"

However, when I run it on web browser(desktop), it works fine.

The following error is displayed on tomcat(android studio)
 
E/AndroidRuntime: FATAL EXCEPTION: main                                                               
        Process: com.company.test6, PID: 18318
        java.lang.RuntimeException: Unable to instantiate application com.salesforce.androidsdk.phonegap.app.HybridApp: java.lang.ClassNotFoundException: Didn't find class "com.salesforce.androidsdk.phonegap.app.HybridApp" on path: DexPathList[[zip file "/data/app/com.company.test6-1/base.apk"],nativeLibraryDirectories=[/data/app/com.company.test6-1/lib/arm, /vendor/lib, /system/lib]]
        at android.app.LoadedApk.makeApplication(LoadedApk.java:680)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6395)
        at android.app.ActivityThread.access$1800(ActivityThread.java:229)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1887)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:148)
        at android.app.ActivityThread.main(ActivityThread.java:7325)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
       Caused by: java.lang.ClassNotFoundException: Didn't find class "com.salesforce.androidsdk.phonegap.app.HybridApp" on path: DexPathList[[zip file "/data/app/com.company.test6-1/base.apk"],nativeLibraryDirectories=[/data/app/com.company.test6-1/lib/arm, /vendor/lib, /system/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
        at android.app.Instrumentation.newApplication(Instrumentation.java:1005)
        at android.app.LoadedApk.makeApplication(LoadedApk.java:670)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6395) 
        at android.app.ActivityThread.access$1800(ActivityThread.java:229) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1887) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:148) 
        at android.app.ActivityThread.main(ActivityThread.java:7325) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
       Suppressed: java.lang.ClassNotFoundException: com.salesforce.androidsdk.phonegap.app.HybridApp
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        ... 12 more
       Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

I tried this:

https://github.com/forcedotcom/SalesforceMobileSDK-Android/issues/1079

But couldn't solve it.

Any help is much appreciated.
 
Is there any way of attaching an image (camera/file browser) to a custom object using Lightning Experience in a Salesforce1 android app? 
I have created a Salesforce1 app(android) which has only visualforce pages. The problems I have been facing is 

1. When I press back button from a vf page, the app closes  

2. When I try to upload an image, the page refreshes and all the entries are lost.

After going through some online resources. I have come up with the following code

   
<script src="/soap/ajax/29.0/connection.js"></script>
    <script type='text/javascript' src='/canvas/sdk/js/publisher.js'/>
    <script src="https://mobile1.t.salesforce.com/soap/ajax/30.0/connection.js" type="text/javascript" />
    <script>
    function myUpdate()
    {
    var accountId = document.getElementById('accountId').value;
    
    Visualforce.remoting.Manager.invokeAction(
    '{!$RemoteAction.StandardController.StandardController}', accountId, function(result, event)
    {
    if(result!=null) sforce.one.navigateToSObject(result,"detail"); 
    Sfdc.canvas.publisher.publish({name: "publisher.close", payload:{ refresh:"true"}});
    
    });
    }
    </script>

    <input id="photoFile" type="file" accept="image/*"/>
    <a href="#" data-role="button" onclick="myUpdate()">Save</a>



This is how my standard controller APEX Class looks like

   
public with sharing class StandardController {
        public ApexPages.StandardController standardController { get; set; }
        public StandardController(ApexPages.StandardController standardController) {
            this.standardController = standardController;
        }
    }

 
I am new to Salesforce.  
After doing a bit of research, I have come up with the following code (I apologize if part of the code doesn't make sense).   
I have created the following visualforce page

        <apex:page standardController="PVID__c" extensions="AccountController"> 
            <script src="/soap/ajax/29.0/connection.js"></script>
            <script type='text/javascript' src='/canvas/sdk/js/publisher.js'/>
            <script src="https://mobile1.t.salesforce.com/soap/ajax/30.0/connection.js" type="text/javascript" />
            <script>
            function myUpdate()
            {
            var accountId = document.getElementById('accountId').value;
            
            Visualforce.remoting.Manager.invokeAction(
            '{!$RemoteAction.AccountController.StandardController}', accountId, function(result, event)
            {
             if(result!=null) sforce.one.navigateToSObject(result,"detail");
            Sfdc.canvas.publisher.publish({name: "publisher.close", payload:{ refresh:"true"}});
            
            });
            }
            </script>
                
            <apex:form >
                
                <h1>Visit</h1>
                <table cellspacing="20"> 
                    <tr>
                        <td>Local Spaces</td>
                    </tr> 
                    <tr>            
                        <td style="padding:0 15px 0 15px;" ><apex:inputField value="{!PVID__c.Common_Areas_Text__c}" style="width: 300px; height: 50px"/></td>
                        <td style="padding:0 15px 0 15px;" ><apex:inputField value="{!PVID__c.Common_Areas_Rating__c}" style="width: 120px; height: 20px"/></td>
                    </tr>     
                </table>
            
                <input id="photoFile" type="file" accept="image/*"/>
                
                <a href="#" data-role="button" onclick="myUpdate()">Save</a>
           
            </apex:form>
    </apex:page>

My AccountController apex class

    public with sharing class StandardController {
        public ApexPages.StandardController standardController { get; set; }
        public StandardController(ApexPages.StandardController standardController) {
            this.standardController = standardController;
        }
    }

What I am finding hard to accomplish.  

1. Attaching a pic to my custom-object (PVID__c)  

2. By default, when you press back button on android Salesforce1 app, it closes. I want to navigate back to previous visualforce page.


Errors:

User-added image

Any help is appreciated, thanks.
Hi,

How do i attach a photo (as a field) to a custom object?

I am able to open the camera & file browser using the statement below 
<input id="photoFile" type="file" accept="image/*"/>

Custom Object Name: PVID
How do I save and attach it with the Custom Object?

Any help appreciated

Thanks
Hi,

How do i attach a photo (as a field) to a custom object?

I am able to open the camera & file browser using the statement below 
<input id="photoFile" type="file" accept="image/*"/>

How do I save and attach it with the Custom Object?

Any help appreciated

Thanks
Hi,

How do i attach a photo (as a field) to a custom object?

I am able to open the camera & file browser using the statement below 
<input id="photoFile" type="file" accept="image/*"/>

Custom Object Name: PVID
How do I save and attach it with the Custom Object?

Any help appreciated

Thanks
Hi,

How do i attach a photo (as a field) to a custom object?

I am able to open the camera & file browser using the statement below 
<input id="photoFile" type="file" accept="image/*"/>

How do I save and attach it with the Custom Object?

Any help appreciated

Thanks

Hello Guys,

i tried to create a hybrid remote app with sf mobile sdk and cordova using forcedroid npm package.
But when i try to build the app and run in emulator using cordova emulate android, the application is not opening and i am getting an error 

"Unfortunately app has been stopped" .
Can someone please help me with this? 

Hello Everyone,

I am new to salesforce1 and having problem while working with VF pages. I have a VF page that saves some records. When i edit any record and updates the value, the value is changed in the database but doesn't reflect on the standard detail page but when i refresh my page then the updated value appeared. I think old value is displaying from the cookies. I am using salesforce1 mobile browser app. Can anyone tell me how can i get the refreshed value?

Thanks in advanced